Method and apparatus for three-dimensional (3D)-tree coding for neural network model compression

ABSTRACT

A method of three-dimensional (3D)-Tree coding for neural network model compression, is performed by at least one processor, and includes reshaping a four-dimensional (4D) parameter tensor of a neural network into a 3D parameter tensor of the neural network, the 3D parameter tensor comprising a convolution kernel size, an input feature size, and an output feature size, partitioning the 3D parameter tensor along a plane that is formed by the input feature size and the output feature size into 3D coding tree units (CTU3Ds), partitioning each of the CTU3Ds into a plurality of 3D coding units (CU3Ds) recursively until a predetermined depth, using a quad-tree, and constructing a 3D tree for each of the plurality of CU3Ds, wherein the 3D tree for each of the plurality of CU3Ds is a 3D-Unitree.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a continuation application of U.S. application Ser.No. 17/536,455, filed on Nov. 29, 2021, which is a continuation of U.S.application Ser. No. 17/081,158, filed on Oct. 27, 2020, now U.S. Pat.No. 11,234,024 issued on Jan. 25, 2022, which claims priority from U.S.Provisional Patent Application No. 62/939,054, filed on Nov. 22, 2019,U.S. Provisional Patent Application No. 62/940,427, filed on Nov. 26,2019, U.S. Provisional Patent Application No. 62/957,699, filed on Jan.6, 2020, U.S. Provisional Patent Application No. 62,957,691, filed onJan. 6, 2020, U.S. Provisional Patent Application No. 62/975,485, filedon Feb. 12, 2020, and U.S. Provisional Patent Application No.62/994,660, filed on Mar. 25, 2020, in the U.S. Patent and TrademarkOffice, the disclosures of which are incorporated herein by reference intheir entireties.

BACKGROUND

Success of Deep Neural Networks (DNNs) in a large range of videoapplications such as semantic classification, targetdetection/recognition, target tracking, video quality enhancement, etc.poses a need for compressing DNN models. Therefore, the Motion PictureExperts Group (MPEG) is actively working on the Coded Representation ofNeural Network standard (NNR) that is used to encode DNN models to saveboth storage and computation.

SUMMARY

According to embodiments, a method of three-dimensional (3D)-Tree codingfor neural network model compression, is performed by at least oneprocessor, and includes reshaping a four-dimensional (4D) parametertensor of a neural network into a 3D parameter tensor of the neuralnetwork, the 3D parameter tensor comprising a convolution kernel size,an input feature size, and an output feature size, partitioning the 3Dparameter tensor along a plane that is formed by the input feature sizeand the output feature size into 3D coding tree units (CTU3Ds),partitioning each of the CTU3Ds into a plurality of 3D coding units(CU3Ds) recursively until a predetermined depth, using a quad-tree,constructing a 3D tree for each of the plurality of CU3Ds, and entropyencoding each of a plurality of values of a plurality of nodes of the 3Dtree.

According to embodiments, an apparatus for adaptive block partitioningfor neural network model compression, includes at least one memoryconfigured to store program code, and at least one processor configuredto read the program code and operate as instructed by the program code.The program code includes reshaping code configured to cause the atleast one processor to reshape a four-dimensional (4D) parameter tensorof a neural network into a 3D parameter tensor of the neural network,the 3D parameter tensor comprising a convolution kernel size, an inputfeature size, and an output feature size, first partitioning codeconfigured to cause the at least one processor to partition the 3Dparameter tensor along a plane that is formed by the input feature sizeand the output feature size, into 3D coding tree units (CTU3Ds), secondpartitioning code configured to cause the at least one processor topartition each of the CTU3Ds into a plurality of 3D coding units (CU3Ds)recursively until a maximum depth, using a quad-tree, first constructingcode configured to cause the at least one processor to construct a3D-Tree for each of the plurality of CU3Ds, and first entropy encodingcode configured to cause the at least one processor to entropy encodeeach of a plurality of values of a plurality of nodes of the 3D tree.

According to embodiments, a non-transitory computer-readable mediumstores instructions that, when executed by at least one processor foradaptive block partitioning for neural network model compression, causethe at least one processor to reshape a four-dimensional (4D) parametertensor of a neural network into a 3D parameter tensor of the neuralnetwork, the 3D parameter tensor comprising a convolution kernel size,an input feature size, and an output feature size, partition the 3Dparameter tensor along a plane that is formed by the input feature sizeand the output feature size, into 3D coding tree units (CTU3Ds),partition each of the CTU3Ds into a plurality of 3D coding units (CU3Ds)recursively until a maximum depth, using a quad-tree, construct a3D-Tree for each of the plurality of CU3Ds, and entropy encode each of aplurality of values of a plurality of nodes of the 3D tree.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram of a GEPM/GEPP partition method.

FIG. 2 is a diagram of an environment in which methods, apparatuses andsystems described herein may be implemented, according to embodiments.

FIG. 3 is a block diagram of example components of one or more devicesof FIG. 2 .

FIG. 4 is a functional block diagram of a system for neural networkmodel compression, according to embodiments.

FIG. 5 is a diagram of two examples of an adaptive CTU3D/3D coding unit(CU3D) partition using a raster scan at a vertical direction, accordingto embodiments.

FIG. 6 is a diagram of an example of a 3D-Octree structure with threedepths, according to embodiments.

FIG. 7 is a flowchart of a method of 3D-Tree coding for neural networkmodel compression, according to embodiments.

FIG. 8 is a block diagram of an apparatus for 3D-Tree coding for neuralnetwork model compression, according to embodiments.

DETAILED DESCRIPTION

This disclosure is related to neural network model compression. To bemore specific, methods and apparatuses described herein are related to3D-Tree coding for neural network model compression.

Scan Order

In the compression of neural networks for multimedia content descriptionand analysis, if a dimension of a weight tensor is more than two (suchas a convolution layer), this weight tensor is reshaped to atwo-dimensional (2D) tensor. No reshape is performed if the dimension ofweight tensor is no more than two (such as a fully connected layer or abias layer).

The encoding method scans weight coefficients in a row-first manner fromleft to right and scans rows from top to bottom.

TABLE 1 quant_weight_tensor( dimensions, maxNumNoRem ) {  dim = Size(dimensions )  for( i = TensorIterator( dim );!TensorIteratorEnd( i,dimensions ); i = TensorIteratorNext( i, dimensions ) {   quant_weight(i, maxNumNoRem )  } }

Quantization

In the compression of neural networks for multimedia content descriptionand analysis, nearest neighbour quantization is applied in a uniform wayto each weight coefficient in weight matrices. A fixed step size isapplied. Reconstructed values in a decoded matrix are integer multiplesof the step size. The step size is defined as a 32-bit floating number.

TABLE 2 step_size( ) {  step_size flt(32) }

step_size is the quantization step size.

Entropy Coding

In the compression of neural networks for multimedia content descriptionand analysis, each quantized weight level is encoded according to thefollowing procedure employing an integer parameter maxNumNoRem:

In a first step, a binary syntax element sig_flag is encoded for thequantized weight level, which specifies whether a corresponding level isequal to zero. If the sig_flag is equal to one, a further binary syntaxelement sign_flag is encoded. A bin indicates if a current weight levelis positive or negative. Next, a unary sequence of bins is encoded,followed by a fixed length sequence as follows:

A variable k is initialized with zero and X is initialized with 1<<k. Asyntax element abs_level_greater_X is encoded, which indicates that anabsolute value of the quantized weight level is greater than X. Ifabs_level_greater_X is equal to 1 and if X is greater than maxNumNoRem,the variable k is increased by 1. Afterwards, 1<<k is added to X and afurther abs_level_greater_X is encoded. This procedure is continueduntil an abs_level_greater_X is equal to 0. Now, X must be one of values(X, X−1, . . . X−(1<<k)+1). A code of length k is encoded, which pointsto values in a list that is an absolute quantized weight level.

Context modeling corresponds to associating three type of flagssig_flag, sign_flag, and abs_level_greater_X with context models. Inthis way, flags with similar statistical behavior may be associated withthe same context model so that a probability estimator (inside of thecontext model) can adapt to underlying statistics.

The context modeling of the presented approach is as follows:

Three context models are distinguished for the sig_flag, depending onwhether a neighboring quantized weight level to the left is zero,smaller than zero, or larger than zero.

Three other context models are distinguished for the sign_flag dependingon whether the neighboring quantized weight level to the left is zero,smaller than zero, or larger than zero.

For the abs_level_greater_X flags, each X uses, either one or twoseparate context models. If X<=maxNumNoRem, two context models aredistinguished depending on the sign_flag. If X>maxNumNoRem, only onecontext model is used.

TABLE 3 quant_weight( i, maxNumNoRem ) {  QuantWeight[i] = 0  sig_flagae(v)  if( sig_flag ) {   QuantWeight[i]++   sign_flag ae(v)   j = −1  do {    j++    abs_level_greater_x [ j ] ae(v)    QuantWeight[i] +=abs_level_greater_x[j]   } while( abs_level_greater_x[j] == 1 && j <  maxNumNoRem )   if( j == maxNumNoRem ) {    RemBits = 0    j = −1   do {     j++     abs_level_greater_x2[ j ] ae(v)     if(abs_level_greater_x2[j] ) {      RemBits++      QuantWeight[i] += 1 <<RemBits     }    } while( abs_level_greater_x2[j] )    abs_remainderuab(RemBits)    QuantWeight[i] += abs_remainder   }   QuantWeight[i] =sign_flag ? -QuantWeight[i] :    QuantWeight[i]  } } sig_flag specifieswhether a quantized weight QuantWeight[i] is nonzero. A sig_flag equalto 0 indicates that QuantWeight[i] is zero. sign_flag specifies whetherthe quantized weight QuantWeight[i] is positive or negative. A sign_flagequal to 1 indicates that QuantWeight[i] is negative.abs_level_greater_x[ j ] indicates whether an absolute level ofQuantWeight[i] is greater j + 1. abs_level_greater_x2[ j ] includes anunary part of an exponential golomb remainder. abs_remainder indicates afixed length remainder.

sig_flag specifies whether a quantized weight QuantWeight[i] is nonzero.A sig_flag equal to 0 indicates that QuantWeight[i] is zero.

sign_flag specifies whether the quantized weight QuantWeight[i] ispositive or negative. A sign_flag equal to 1 indicates thatQuantWeight[i] is negative.

abs_level_greater_x[j] indicates whether an absolute level ofQuantWeight[i] is greater j+1.

abs_level_greater_x2[j] includes an unary part of an exponential golombremainder.

abs_remainder indicates a fixed length remainder.

Inference operation for deep learning system uses matrix multiplicationintensively so a high-performance matrix multiplication library (GEMM)is the key for inference operation. Depending on a size of aleft-hand-side (lhs) matrix and a right-hand-side (rhs) matrix, two GEMMroutines (GEPP/GEBP, GEPM/GEBP) are recognized by the industry over thelast decade as the optimal GEMM solution. As shown in FIG. 1 , bothmethods partition the lhs matrix and the rhs matrix recursively to makethe best use of different characteristics of off-chip memory (such asDouble Data Rate (DDR)) and on-chip memory (such as multi-level cache)in modern computing platform, and the lhs matrix is usually stored in acolumn-major order to achieve the optimal memory access pattern. The lhsmatrix is usually transposed to achieve the optimal memory accesspattern. Some newer GEMM routines (such as QNNPACK) are optimized forneural networks designed for mobile and edge devices, are a variation ofeither a GEPP routine or a GEPM routine, and follow a similar matrixblocking/partitioning method.

A matrix scan order in the NNR is defined as a row-first manner fromleft to right and rows from top to bottom. This scan order does notmatch with a scan order required by the inference operation, as theinference operation must buffer an excessive size of weight coefficientsbefore starts the operation. For example, when the inference operationis performed for a first fully-connect layer of VGG16, given that amatrix size of this layer is 25088×4096, a buffer that can store Nx25088coefficients has to be reserved to perform a GEMM routine. If N=64 for anormal GEMM operation, a buffer size will be 1.5 MB even if coefficientsare represented by an 8-bit integer instead of a 32-bit floating number,but such a buffer size is too high especially for mobile and edgedevices.

Further, entropy coding in the NNR is performed on a quantized weightcoefficient directly. The NNR did not consider a local distributionafter a weight tensor is partitioned to non-overlapping 2D/3D codingtree units (CTUs)/3D coding tree units (CTU3Ds). Most weightcoefficients are zeros after a sparse/prune operation.

FIG. 2 is a diagram of an environment 200 in which methods, apparatusesand systems described herein may be implemented, according toembodiments. As shown in FIG. 2 , the environment 200 may include a userdevice 210, a platform 220, and a network 230. Devices of theenvironment 200 may interconnect via wired connections, wirelessconnections, or a combination of wired and wireless connections.

The user device 210 includes one or more devices capable of receiving,generating, storing, processing, and/or providing information associatedwith platform 220. For example, the user device 210 may include acomputing device (e.g., a desktop computer, a laptop computer, a tabletcomputer, a handheld computer, a smart speaker, a server, etc.), amobile phone (e.g., a smart phone, a radiotelephone, etc.), a wearabledevice (e.g., a pair of smart glasses or a smart watch), or a similardevice. In some implementations, the user device 210 may receiveinformation from and/or transmit information to the platform 220.

The platform 220 includes one or more devices as described elsewhereherein. In some implementations, the platform 220 may include a cloudserver or a group of cloud servers. In some implementations, theplatform 220 may be designed to be modular such that software componentsmay be swapped in or out. As such, the platform 220 may be easily and/orquickly reconfigured for different uses.

In some implementations, as shown, the platform 220 may be hosted in acloud computing environment 222. Notably, while implementationsdescribed herein describe the platform 220 as being hosted in the cloudcomputing environment 222, in some implementations, the platform 220 maynot be cloud-based (i.e., may be implemented outside of a cloudcomputing environment) or may be partially cloud-based.

The cloud computing environment 222 includes an environment that hoststhe platform 220. The cloud computing environment 222 may providecomputation, software, data access, storage, etc. services that do notrequire end-user (e.g., the user device 210) knowledge of a physicallocation and configuration of system(s) and/or device(s) that hosts theplatform 220. As shown, the cloud computing environment 222 may includea group of computing resources 224 (referred to collectively as“computing resources 224” and individually as “computing resource 224”).

The computing resource 224 includes one or more personal computers,workstation computers, server devices, or other types of computationand/or communication devices. In some implementations, the computingresource 224 may host the platform 220. The cloud resources may includecompute instances executing in the computing resource 224, storagedevices provided in the computing resource 224, data transfer devicesprovided by the computing resource 224, etc. In some implementations,the computing resource 224 may communicate with other computingresources 224 via wired connections, wireless connections, or acombination of wired and wireless connections.

As further shown in FIG. 2 , the computing resource 224 includes a groupof cloud resources, such as one or more applications (“APPs”) 224-1, oneor more virtual machines (“VMs”) 224-2, virtualized storage (“VSs”)224-3, one or more hypervisors (“HYPs”) 224-4, or the like.

The application 224-1 includes one or more software applications thatmay be provided to or accessed by the user device 210 and/or theplatform 220. The application 224-1 may eliminate a need to install andexecute the software applications on the user device 210. For example,the application 224-1 may include software associated with the platform220 and/or any other software capable of being provided via the cloudcomputing environment 222. In some implementations, one application224-1 may send/receive information to/from one or more otherapplications 224-1, via the virtual machine 224-2.

The virtual machine 224-2 includes a software implementation of amachine (e.g., a computer) that executes programs like a physicalmachine. The virtual machine 224-2 may be either a system virtualmachine or a process virtual machine, depending upon use and degree ofcorrespondence to any real machine by the virtual machine 224-2. Asystem virtual machine may provide a complete system platform thatsupports execution of a complete operating system (“OS”). A processvirtual machine may execute a single program, and may support a singleprocess. In some implementations, the virtual machine 224-2 may executeon behalf of a user (e.g., the user device 210), and may manageinfrastructure of the cloud computing environment 222, such as datamanagement, synchronization, or long-duration data transfers.

The virtualized storage 224-3 includes one or more storage systemsand/or one or more devices that use virtualization techniques within thestorage systems or devices of the computing resource 224. In someimplementations, within the context of a storage system, types ofvirtualizations may include block virtualization and filevirtualization. Block virtualization may refer to abstraction (orseparation) of logical storage from physical storage so that the storagesystem may be accessed without regard to physical storage orheterogeneous structure. The separation may permit administrators of thestorage system flexibility in how the administrators manage storage forend users. File virtualization may eliminate dependencies between dataaccessed at a file level and a location where files are physicallystored. This may enable optimization of storage use, serverconsolidation, and/or performance of non-disruptive file migrations.

The hypervisor 224-4 may provide hardware virtualization techniques thatallow multiple operating systems (e.g., “guest operating systems”) toexecute concurrently on a host computer, such as the computing resource224. The hypervisor 224-4 may present a virtual operating platform tothe guest operating systems, and may manage the execution of the guestoperating systems. Multiple instances of a variety of operating systemsmay share virtualized hardware resources.

The network 230 includes one or more wired and/or wireless networks. Forexample, the network 230 may include a cellular network (e.g., a fifthgeneration (5G) network, a long-term evolution (LTE) network, a thirdgeneration (3G) network, a code division multiple access (CDMA) network,etc.), a public land mobile network (PLMN), a local area network (LAN),a wide area network (WAN), a metropolitan area network (MAN), atelephone network (e.g., the Public Switched Telephone Network (PSTN)),a private network, an ad hoc network, an intranet, the Internet, a fiberoptic-based network, or the like, and/or a combination of these or othertypes of networks.

The number and arrangement of devices and networks shown in FIG. 2 areprovided as an example. In practice, there may be additional devicesand/or networks, fewer devices and/or networks, different devices and/ornetworks, or differently arranged devices and/or networks than thoseshown in FIG. 2 . Furthermore, two or more devices shown in FIG. 2 maybe implemented within a single device, or a single device shown in FIG.2 may be implemented as multiple, distributed devices. Additionally, oralternatively, a set of devices (e.g., one or more devices) of theenvironment 200 may perform one or more functions described as beingperformed by another set of devices of the environment 200.

FIG. 3 is a block diagram of example components of one or more devicesof FIG. 2 . The device 300 may correspond to the user device 210 and/orthe platform 220. As shown in FIG. 3 , device 300 may include a bus 310,a processor 320, a memory 330, a storage component 340, an inputcomponent 350, an output component 360, and a communication interface370.

The bus 310 includes a component that permits communication among thecomponents of the device 300. The processor 320 is implemented inhardware, firmware, or a combination of hardware and software. Theprocessor 320 is a central processing unit (CPU), a graphics processingunit (GPU), an accelerated processing unit (APU), a microprocessor, amicrocontroller, a digital signal processor (DSP), a field-programmablegate array (FPGA), an application-specific integrated circuit (ASIC), oranother type of processing component. In some implementations, theprocessor 320 includes one or more processors capable of beingprogrammed to perform a function. The memory 330 includes a randomaccess memory (RAM), a read only memory (ROM), and/or another type ofdynamic or static storage device (e.g., a flash memory, a magneticmemory, and/or an optical memory) that stores information and/orinstructions for use by the processor 320.

The storage component 340 stores information and/or software related tothe operation and use of the device 300. For example, the storagecomponent 340 may include a hard disk (e.g., a magnetic disk, an opticaldisk, a magneto-optic disk, and/or a solid state disk), a compact disc(CD), a digital versatile disc (DVD), a floppy disk, a cartridge, amagnetic tape, and/or another type of non-transitory computer-readablemedium, along with a corresponding drive.

The input component 350 includes a component that permits the device 300to receive information, such as via user input (e.g., a touch screendisplay, a keyboard, a keypad, a mouse, a button, a switch, and/or amicrophone). Additionally, or alternatively, the input component 350 mayinclude a sensor for sensing information (e.g., a global positioningsystem (GPS) component, an accelerometer, a gyroscope, and/or anactuator). The output component 360 includes a component that providesoutput information from the device 300 (e.g., a display, a speaker,and/or one or more light-emitting diodes (LEDs)).

The communication interface 370 includes a transceiver-like component(e.g., a transceiver and/or a separate receiver and transmitter) thatenables the device 300 to communicate with other devices, such as via awired connection, a wireless connection, or a combination of wired andwireless connections. The communication interface 370 may permit thedevice 300 to receive information from another device and/or provideinformation to another device. For example, the communication interface370 may include an Ethernet interface, an optical interface, a coaxialinterface, an infrared interface, a radio frequency (RF) interface, auniversal serial bus (USB) interface, a Wi-Fi interface, a cellularnetwork interface, or the like.

The device 300 may perform one or more processes described herein. Thedevice 300 may perform these processes in response to the processor 320executing software instructions stored by a non-transitorycomputer-readable medium, such as the memory 330 and/or the storagecomponent 340. A computer-readable medium is defined herein as anon-transitory memory device. A memory device includes memory spacewithin a single physical storage device or memory space spread acrossmultiple physical storage devices.

Software instructions may be read into the memory 330 and/or the storagecomponent 340 from another computer-readable medium or from anotherdevice via the communication interface 370. When executed, softwareinstructions stored in the memory 330 and/or the storage component 340may cause the processor 320 to perform one or more processes describedherein. Additionally, or alternatively, hardwired circuitry may be usedin place of or in combination with software instructions to perform oneor more processes described herein. Thus, implementations describedherein are not limited to any specific combination of hardware circuitryand software.

The number and arrangement of components shown in FIG. 3 are provided asan example. In practice, the device 300 may include additionalcomponents, fewer components, different components, or differentlyarranged components than those shown in FIG. 3 .

Additionally, or alternatively, a set of components (e.g., one or morecomponents) of the device 300 may perform one or more functionsdescribed as being performed by another set of components of the device300.

FIG. 4 is a functional block diagram of a system 400 for neural networkmodel compression, according to embodiments.

As shown in FIG. 4 , the system 400 includes a parameter reductionmodule 405, a parameter approximation module 410, a reconstructionmodule 415, an encoder 420, and a decoder 425.

The parameter reduction module 405 reduces a set of parameters of aninput neural network, to obtain an output neural network. The neuralnetwork may include the parameters and an architecture as specified by adeep learning framework.

For example, the parameter reduction module 405 may sparsify (setweights to zero) and/or prune away connections of the neural network. Inanother example, the parameter reduction module 405 may perform matrixdecomposition on parameter tensors of the neural network into a set ofsmaller parameter tensors. The parameter reduction module 405 mayperform these methods in cascade, for example, may first sparsify theweights and then decompose a resulting matrix.

The parameter approximation module 410 applies parameter approximationtechniques on parameter tensors that are extracted from the outputneural network that is obtained from the parameter reduction module 405.For example, the techniques may include any one or any combination ofquantization, transformation and prediction. The parameter approximationmodule 410 outputs first parameter tensors that are not modified by theparameter approximation module 410, second parameter tensors that aremodified or approximated by the parameter approximation module 410, andrespective metadata to be used to reconstruct original parameter tensorsthat are not modified by the parameter approximation module 410, fromthe modified second parameter tensors.

The reconstruction module 415 reconstructs the original parametertensors from the modified second parameter tensors that are obtainedfrom the parameter approximation module 410 and/or the decoder 425,using the respective metadata that is obtained from the parameterapproximation module 410 and/or the decoder 425. The reconstructionmodule 415 may reconstruct the output neural network, using thereconstructed original parameter tensors and the first parametertensors.

The encoder 420 may perform entropy encoding on the first parametertensors, the second parameter tensors and the respective metadata thatare obtained from the parameter approximation module 410. Thisinformation may be encoded into a bitstream to the decoder 425.

The decoder 425 may decode the bitstream that is obtained from theencoder 420, to obtain the first parameter tensors, the second parametertensors and the respective metadata.

The system 400 may be implemented in the platform 220, and one or moremodules of FIG. 4 may be performed by a device or a group of devicesseparate from or including the platform 220, such as the user device210.

Methods and apparatuses for 3D-Tree coding for neural network modelcompression will now be described in detail.

CTU3D Partition

If an lhs tensor is stored in a column-major order, or after a transposeof a row-major tensor, a dimension of a weight tensor is usually 4 for aconvolution layer with a layout of [R][S][C][K], 2 for a fully-connectedlayer with a layout of [C][K], and 1 for a bias and batch normal layer.R/S is a convolution kernel size, C is an input feature size and K is anoutput feature size.

In embodiments, for the convolution layer, a 2D [R][S] dimension isreshaped to an 1D [RS] dimension so that the four-dimensional (4D)tensor [R][S][C][K] is reshaped to a 3D tensor [RS][C][K]. Thefully-connected layer is treated as a special case of the 3D tensor withR=S=1.

As the kernel size RS is usually much smaller than C/K, the 3D tensor[RS][C][K] is partitioned along a [C][K] plane with non-overlappingsmaller blocks (CTU3D). Each CTU3D has a shape of[RS][ctu3d_height][ctu3d_width], where ctu3d_height=max_ctu3d_height,ctu3d_width=max_ctu3d_width, and max_ctu3d_height/max_ctu3d_width isencoded in a model header. For a CTU3D that is located at the rightand/or bottom of the tensor, its ctu3d_height is a remainder ofC/max_ctu3d_height, and its ctu3d_width is a remainder ofK/max_ctu3d_width.

As shown in FIG. 5 , for a CTU3D 505, at the right and/or bottom of atensor, a parent CU3D node 510 at a given depth may not have all 4 childnodes. For the CU3D 510 that is located at the right and/or bottom of atensor, cu3d_height is a remainder of max_ctu3d_height/max_cu3d_height,and cu3d_width is a remainder of max_ctu3d_width/max_cu3d_width.

In further embodiments, a square shape partition is used so thatmax_ctu3d_height=max_ctu3d_width, and a variable max_ctu3d_size is usedto represent both max_ctu3d_height and max_ctu3d_width. max_ctu3d_sizeis defined as 2**N, and a value of N is 8, 16, 32, 64.

To facilitate an on-chip memory requirement in an inference operation,in embodiments, a flag is defined to indicate whether there is limit fora total CTU3D size for layers with different kernel sizes. The flag thatequals to 0 indicates that ctu3d_height/ctu3d_width is kept unchangedregardless of the kernel size, and in this case, a size of a CTU3D forthe convolution layer is RS times bigger than a size of a CTU3D for thefully-connected layer. The flag that equals to 1 indicates thatctu3d_height/ctu3d_width is scaled based on the kernel size. Forexample, ctu3d_height=ctu3d_width=int(ctu3d_height*ctu3d_width/R/S).

While any scan order can be used to scan and process CTU3Ds in a 3Dtensor, in embodiments, they are scanned and processed using a rasterscan order at either a horizontal direction (SCAN_CK) or a verticaldirection (SCAN_KC).

An example of corresponding syntax tables is listed below in Tables 4-6:

TABLE 4 nnr( ) {  . . .  layer_header( )  if(enable_max_ctu3d_size){  max_ctu3d_height = max_ctu3d_width=int( embodi-  max_ctu3d_size*max_ctu3d_size/R/S), or ment 1   max_ctu3d_height=max_ctu3d_width=(2**(bitdepth(int( embodi-   max_ctu3d_size *max_ctu3d_size /R/S))-1) ment 2  }  if(layer_scan_order==SCAN_CK){  for(c=0;c<C;c+=max_ctu3d_height){    for(k=0;k<K;k+=max_ctu3d_width) {    ctu3d_height=min(max_ctu3d_height,C-c);    ctu3d_width=min(max_ctu3d_width,K-k);    last_ctu3d_flag=(max_ctu3d_height>=C-c &&    max_ctu3d_width>=K-k)?1:0     ctu3d(c,k,ctu3d_height,ctu3d_width)    end_of_layer(last_ctu3d_flag)    }   }  }elseif(layer_scan_order==SCAN_KC){   for(k=0;k<K;k+=max_ctu3d_width) {   for(c=0;c<C;c+=max_ctu3d_height){    ctu3d_height=min(max_ctu3d_height,C-c);    ctu3d_width=min(max_ctu3d_width,K-k);    last_ctu3d_flag=(max_ctu3d_height>=C-c &&    max_ctu3d_width>=K-k)?1:0     ctu3d(c,k,ctu3d_height,ctu3d_width)    end_of_layer(last_ctu3d_flag)    }   }  } }

TABLE 5 nnr_header( ) {  ......  enable_max_ctu3d_size  max_ctu3d_idx ...... }

enable_max_ctu3d_size being 0 indicates that ctu3d_height/ctu3d_width iskept unchanged regardless of the kernel size, and enable_max_ctu3d_sizebeing 1 indicates that ctu3d_height/ctu3d_width is scaled based on thekernel size.

max_ctu3d_idx is in the following equation:max_ctu3d_size=(max_ctu3d_idx==0)?64:(max_ctu3d_idx==1)?32:(max_ctu3d_idx==2)?16:8  (1)

TABLE 6 layer_header( ) {  ......  layer_scan_order  ...... }

layer_scan_order being 0 indicates the raster scan order at a horizontaldirection, and layer_scan_order being 1 indicates the raster scan orderat a vertical direction.

Adaptive CU3D Partition

In embodiments, a CTU/CU adaptive partitioning method that is used invideo coding standards is used.

A simplified blocking structure is used, where a CTU3D/CU3D ispartitioned to smaller CU3Ds recursively using a quad-tree structureuntil a maximum recursive depth is reached. Starting from a CTU3D node,this quad-tree of a CU3D is scanned and processed using a depth-firstquad-tree scan order. Child nodes under the same parent node are scannedand processed using a raster scan order at either a horizontal directionor a vertical direction.

For a CU3D at a given quad-tree depth, a max_cu3d_height/max_cu3d_widthof these CU3Ds is calculated using Equations (2) and (3) below, and amaximum recursive depth is reached when both max_cu3d_height andmax_cu3d_width is smaller than or equal to a predefined threshold. Thisthreshold can either be included in a bitstream explicitly, or can be apredefined number (such as 8) so it can be inferred by a decoderimplicitly.max_cu3d_height=max_ctu3d_height>>depth  (2)max_cu3d_width=max_ctu3d_width>>depth  (3)

In further embodiments, a square shape partition is used so thatmax_ctu3d_height=max_ctu3d_width. For a CU3D at a given quad-tree depth,a max_cu3d_size of these CU3Ds is calculated using Equation (4) below,and a maximum recursive depth is reached when max_cu3d_size is smallerthan or equal to a predefined threshold. This threshold can either beincluded in a bitstream explicitly, or can be a predefined number (suchas 8) so it can be inferred by a decoder implicitly.max_cu3d_size=max_ctu3d_size>>depth  (4)

As shown in FIG. 5 , for a CTU3D 505, at the right and/or bottom of atensor, a parent CU3D node 510 at a given depth may not have all 4 childnodes. For the CU3D 510 that is located at the right and/or bottom of atensor, cu3d_height is a remainder of max_ctu3d_height/max_cu3d_height,and cu3d_width is a remainder of max_ctu3d_width/max_cu3d_width.

In further embodiments, a Rate-Distortion (RD) based encoding algorithmis used to decide whether a parent CU3D is split to multiple smallerchild CU3Ds. The parent CU3D is split to the multiple smaller childCU3Ds if a combined RD of these smaller child CU3Ds is smaller than a RDfrom the parent CU3D. Otherwise, the parent CU3D is not split. A splitflag is defined to record this splitting decision.

An example of a corresponding syntax table is listed below in Tables 7and 8:

TABLE 7 ctu3d(...) {  ......  cu3d(0,0,0)  ...... }

TABLE 8 cu3d(depth,y_idx,x_idx){  ......  if(cu3d does not exist)  return  if(depth<ctu3d_depth−1){   split_flag   if(split_flag){   cu3d(depth+1,(y_idx<<1),(x_idx<<1))   cu3d(depth+1,(y_idx<<1)+1,(x_idx<<1))   cu3d(depth+1,(y_idx<<1),(x_idx<<1)+1)   cu3d(depth+1,(y_idx<<1)+1,(x_idx<<1)+1)    return   }  }  ...... }

split_flag is a flag to indicate if a parent CU3D is split to 4 smallerchild CU3Ds.

Kernel Plane Reorder

As discussed above, a simplified blocking structure is used, in which aCTU3D/CU3D is partitioned to a smaller CU3D recursively, using aquad-tree structure until a maximum recursive depth is reached.

In further embodiments, to facilitate a better compression operation, anRS number of 2D planes within a CU3D or CTU3D can be reordered along an[RS] axis. Reorder indices are encoded in a CU3D header so that eachCU3D has its own reorder index, or encoded in a CTU3D header so that allCU3D in this CTU3D share the same reorder indices. A flag is defined toindicate if a reorder operation is allowed. This flag is encoded ineither a model header or a layer header.

A zdep_array[RS] is defined to store a reordered index of an RS numberof 2D planes. zdep_array[n] indicates that an index n of a reordered 2Dplane is from the index zdep_array[n] of an original 2D plane. Because afirst 2D plane does not need to be reordered to another location,zdep_arrya[0] is always 0.

Because a reorder operation is always performed in a closed form, azdep_array can be scanned starting from next_idx=first_idx, andnext_idx=zdep_array[next_idx] is iteratively assigned. A loop will befound in which zdep_array[next_idx]=first_idx. If not all indices ofzdep_array are included in this loop, the zdep_array can be continuouslyscanned starting from a first index that is not included in all previousloops, and next_idx=zdep_array[next_idx] is iteratively assigned.

A queue is defined to store a sequence of next_idx, using theaforementioned zdep_array scanning method. A pseudo code for queuegeneration is listed below:

if (zdep_arry[++idx] != −1) {  first_idx = idx;  while (zdep_arry[idx]!= first_idx) {   next_idx = zdep_arry[idx];  queue.push_back(next_idx);    zdep_arry[idx] = −1;   idx = next_idx; }  queue.push_back(−1);  zdep_arry[idx] = −1;  idx = first_idx; }

Based on the reordering method, content of first and last locations ofthis queue can be inferred, and the content of the last location of anygiven loop can be inferred as well.

An example of a corresponding syntax table is listed below in Tables9-11:

TABLE 9 nnr_header( ) {  ......  enable_zdep_reorder  ...... }

enable_zdep_reorder being 0 indicates that reorder of zdep_array is notallowed, and enable_zdep_reorder being 1 indicates that reorder of thezdep_array is allowed.

TABLE 10 ctu3d_header( ) {  ......  zdep_array( )  ...... }

TABLE 11 zdep_array( ) {  ......  reorder_flag=false if(enable_zdep_reorder && zdep_size>2)   reorder_flag if(!reorder_flag){   for(n=0;n<zdep_size;++n)    zdep_array[n]=n;  return;  }  queue[0]=−1;  for(n=1;n<zdep_size−1;++n){   signalled_flag  queue[n]=(signalled_flag)?1:(queue[n−1]>0)?−2:−1;  } queue[zdep_size−1]=(queue[zdep_size−2]>0)?−2:−1; for(n=0;n<zdep_size;++n){   zdep_array[n]=−1;   if(queue[n]==1){   qval_minus_one    queue[n]=qval_minus_one+1;   }  }  qidx=0, zidx=−1; do{   while(zdep_array[++zidx]!=−1);   if(queue[qidx]==−1){   zdep_array[zidx]=zidx;   }else{    first_zidx=zidx;   while(queue[qidx]!=−2){     zdep_array[zidx]=queue[qidx];    zidx=queue[qidx];     ++qidx;    }    zdep_array[zidx]= first_zidx;   zidx= first_zidx;   }   ++qidx;  }while(qidx<zdep_size);  ...... }reorder_flag being 0 indicates that zdep_array is not reordered, andreorder_flag being 1 indicates that the zdep_array is reordered.signalled_flag being 0 indicates that content of location n of a queueis inferred, and signalled_flag being 1 indicates that the content ofthe location n of the queue is signaled. qval_minus_one indicates thatthe content of the location n of the queue = qval_minus_one + 1.

reorder_flag being 0 indicates that zdep_array is not reordered, andreorder_flag being 1 indicates that the zdep_array is reordered.

signalled_flag being 0 indicates that content of location n of a queueis inferred, and signalled_flag being 1 indicates that the content ofthe location n of the queue is signaled.

qval_minus_one indicates that the content of the location n of thequeue=qval_minus_one+1.

In further embodiments, a 3D-Octree structure, a 3D-Tagtree structure, a3D3-Unitree structure and corresponding encoding methods may be used toencode a CU3D.

3D-Octree Coding

As shown in FIG. 6 , an Octree 605 is a tree data structure in whicheach internal node 610 has exactly eight child nodes 615. A 3D-Octree isused to partition a three-dimensional tensor 620 by recursivelysubdividing it along z, y, x axes into eight octants 625.

In embodiments, a 3D-Octree structure may be used to representsignificant (non-zero) states of coefficients in a CU3D.

A 3D-Octree for a CU3D is constructed as follows. A node value of 1 fora 3D-Octree location at a last depth indicates that a codebook index (ifa codebook coding method is used) or a coefficient (if a directquantization coding method is used) in a corresponding CU3D is otherthan zero. A node value of 0 for a 3D-Octree location at a bottom depthindicates that a codebook index or a coefficient in a corresponding CU3Dis zero. A node value for a 3D-Octree location at another depth isdefined as a maximum or minimum value of its eight child nodes.

After the 3D-Octree is constructed, all nodes are scanned using apredefined scan order to encode respective node values.

In one embodiment, starting from a top node, a depth-first-search isused to scan all child nodes. A scan order for child nodes that sharethe same parent node can be defined arbitrarily, such as(0,0,0)→(0,0,1)→(0,1,0)→(0,1,1)→(1,0,0)→(1,0,1)→(1,1,0)→(1,1,1).

In another embodiment, starting from a top node, a breadth-first-searchis used to scan all child nodes. A scan order for child nodes that sharethe same parent node can be defined arbitrarily, such as(0,0,0)→(0,0,1)→(0,1,0)→(0,1,1)→(1,0,0)→(1,0,1)→(1,1,0)→(1,1,1).

Several node skipping methods are introduced to obtain a compactrepresentation of a bitstream.

If a node value for a 3D-Octree location at another depth is defined asa maximum value of its eight child nodes, and if a value of a parentnode is 0, scanning and encoding of its child nodes (and their childnodes) is skipped as their values should always be 0. If the value ofthe parent node is 1 and the values of all but last child nodes are all0s, a last child node is still scanned, but the encoding of its value isskipped as it should always be 1.

If a node value for a 3D-Octree location at another depth is defined asa minimum value of its eight child nodes, and if a value of a parentnode is 1, scanning and encoding of its child nodes (and their childnodes) is skipped as their values should always be 1. If the value ofthe parent node is 0 and the values of all but last child nodes are allIs, a last child node is still scanned, but the encoding of its value isskipped as it should always be 0.

An encoding_start_depth is defined to indicate a first depth thatparticipates in an encoding process. When all nodes are scanned using apredefined scan order, encoding of a current node value is skipped if adepth of this node is above encoding_start_depth.

If a value of a node at a bottom depth is 1, its corresponding non-zerocodebook index is encoded if a codebook coding method is used. If adirect quantization coding method is used, a sign bit of itscorresponding non-zero coefficient is encoded, followed by an absolutevalue of the nonzero coefficient.

For some CU3Ds with different depths/heights/widths, there are notenough coefficients to construct a complete 3D-Octree in which allparent nodes have all eight child nodes available. Scanning and encodingof these non-exist child nodes are skipped if a parent node does nothave all eight child nodes.

An example of a corresponding syntax table is listed below in Table 12:

TABLE 12 octree3d(start_depth,depth,z_idx,y_idx,x_idx,skip){  ...... proceed=nzflag=bmp[depth][z_idx][y_idx][x_idx]=1 if(depth>=start_depth){   if(!skip){    nzflag   bmp[depth][z_idx][y_idx][x_idx]=nzflag   }   proceed=nzflag  } if(proceed){   if(depth<total_depth−1){    skip=false   next_z_idx=(z_idx<<1)    next_y_idx=(y_idx<<1)   next_x_idx=(x_idx<<1)    if(location [next_z_idx][ next_y_idx][next_x_idx] exist in next depth){ octree3d(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx,skip)   }    if(location [next_z_idx][ next_y_idx][ next_x_idx+1] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and bit value of all other child nodes are zero octree3d(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx+1,skip)   }    if(location [next_z_idx][ next_y_idx+1][ next_x_idx] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and bit value of all other child nodes are zero octree3d(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx,skip)   }    if(location [next_z_idx][ next_y_idx+1][ next_x_idx+1] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and bit value of all other child nodes are zero octree3d(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx+1,skip)   }    if(location [next_z_idx+1][ next_y_idx][ next_x_idx] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and bit value of all other child nodes are zero octree3d(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx,skip)   }    if(location [next_z_idx+1][ next_y_idx][ next_x_idx+1] exist innext depth){     if(depth>=start depth)      skip=this is the last childnode and bit value of all other child nodes are zero octree3d(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx+1,skip)   }    if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and bit value of all other child nodes are zero octree3d(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx,skip)   }    if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx+1] existin next depth){     if(depth>=start_depth)      skip=this is the lastchild node and bit value of all other child nodes are zero octree3d(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx+1,skip)   }    return   }   if(codebook_size){    index   map[z_idx][y_idx][x_idx]=index   }else{    sign    abs_q   map[z_idx][y_idx][x_idx]=(sign?-int(abs_q):abs_q)   }  }  ...... }nzflag non-zero flag of the index index index value sign sign bit of thequantized coefficient abs_q absolute value of the quantized coefficient

-   -   nzflag non-zero flag of the index    -   index index value    -   sign sign bit of the quantized coefficient    -   abs_q absolute value of the quantized coefficient

3D-Tagtree Coding

In embodiments, a 3D-Tagtree structure may be used to represent absolutevalues of coefficients in a CU3D.

A 3D-Tagtree for a CU3D is constructed as follows. A node value for a3D-Tagtree location at a last depth indicates an absolute value of acodebook index (if a codebook coding method is used) or an absolutecoefficient (if a direct quantization coding method is used) in acorresponding CU3D is other than zero. A node value for a 3D-Tagtreelocation at another depth is defined as a maximum or minimum value ofits eight child nodes.

After the 3D-Tagtree is constructed, all nodes are scanned using apredefined scan order to encode respective node values.

In one embodiment, starting from a top node, a depth-first-search isused to scan all child nodes. A scan order for child nodes that sharethe same parent node can be defined arbitrarily, such as(0,0,0)→(0,0,1)→(0,1,0)→(0,1,1)→(1,0,0)→(1,0,1)→(1,1,0)→(1,1,1).

In another embodiment, starting from a top node, a breadth-first-searchis used to scan all child nodes. A scan order for child nodes that sharethe same parent node can be defined arbitrarily, such as(0,0,0)→(0,0,1)→(0,1,0)→(0,1,1)→(1,0,0)→(1,0,1)→(1,1,0)→(1,1,1).

A node value is encoded if a corresponding node is a top node that doesnot have a parent node. For any child node, a difference between aparent node and the child node is encoded. Several node skipping methodsare introduced to obtain a compact representation of a bitstream.

If a node value for a 3D-Tagtree location at another depth is defined asa maximum value of its eight child nodes, and if a value of a parentnode is 0, scanning and encoding of its child nodes (and their childnodes) is skipped as their values should always be 0. If the value of aparent node is X and the values of all but last child nodes are smallerthan X, a last child node is still scanned, but the encoding of itsvalue is skipped as it should always be X.

If a node value for a 3D-Tagtree location at another depth is defined asa minimum value of its eight child nodes, and if a value of a parentnode is X and values of all but last child nodes are bigger than X, alast child node is still scanned, but encoding of its value is skippedas it should always be X.

An encoding_start_depth is defined to indicate a first depth thatparticipates in an encoding process. When all nodes are scanned using apredefined scan order, encoding of a current node value is skipped if adepth of this node is above encoding_start_depth. An actual valueinstead of a difference between a parent node and this current node isencoded if the depth of this node equals to encoding_start_depth.

If a value of a node at a bottom depth is not zero and a directquantization coding method is used, a sign bit of its correspondingnon-zero coefficient is encoded.

For some CU3Ds with different depths/heights/widths, there are notenough coefficients to construct a complete 3D-Tagtree in which allparent node have all eight child nodes available. Scanning and encodingof these non-exist child nodes are skipped if a parent node does nothave all eight child nodes.

An example of a corresponding syntax table is listed below in Table 13:

TABLE 13 tagtree3d(start_depth,depth,z_idx,y_idx,x_idx,skip){  ...... proceed=nzflag=1  if(depth)  rmap[depth][z_idx][y_idx][x_idx]=rmap[depth−1] [z_idx>>1][y_idx>>1][x_idx>>1]  if(depth>=start_depth){   if(!skip){   if(codebook_size){     if(depth==start_depth){      index=0     nzflag_index      if(nzflag_index)       index     rmap[depth][z_idx][y_idx][x_idx]=index     }else{      delta_index     rmap[depth][z_idx][y_idx][x_idx]=       rmap[depth−1][z_idx>>1][y_idx>>1][x_idx>>1]−delta_index     }    }else{    if(depth==start_depth){      abs_q=0      nzflag_q      if(nzflag_q)      abs_q      rmap[depth][z_idx][y_idx][x_idx]=abs_q     }else{     delta_abs_q      rmap[depth][z_idx][y_idx][x_idx]=      rmap[depth− 1][z_idx>>1][y_idx>>1][x_idx>>1]−delta_abs_q     }   }    nzflag=(rmap[depth][z_idx][y_idx][x_idx]!=0)   }  if(depth==total_depth−1&nzflag&&codebook_size==0){    sign_q   rmap[depth][z_idx][y_idx][x_idx]=     (sign?-int(rmap[depth][z_idx][y_idx][x_idx]):rmap[depth][z_idx][y_idx][x_idx])  }   proceed=nzflag  }  if(proceed){   if(depth<total_depth−1){   skip=false    next_z_idx=(z_idx<<1)    next_y_idx=(y_idx<<l)   next_x_idx=(x_idx<<l)    if(location [next_z_idx][ next_y_idx][next_x_idx] exist in next depth){ tagtree3d(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx,skip)   }    if(location [next_z_idx][ next_y_idx][ next_x_idx+1] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and value of all other child nodes are smaller than value of parentnode tagtree3d(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx+1,skip)   }    if(location [next_z_idx][ next_y_idx+1][ next_x_idx] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and value of all other child nodes are smaller than value of parentnode tagtree3d(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx,skip)   }    if(location [next_z_idx][ next_y_idx+1][ next_x_idx+1] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and value of all other child nodes are smaller than value of parentnode tagtree3d(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx+1,skip)   }    if(location [next_z_idx+1][ next_y_idx][ next_x_idx] exist innext depth)     if(depth>=start_depth)      skip=this is the last childnode and value of all other child nodes are smaller than value of parentnode tagtree3d(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx,skip)   if(location [next_z_idx+1][ next_y_idx][ next_x_idx+1] exist in nextdepth){     if(depth>=start_depth)      skip=this is the last child nodeand value of all other child nodes are smaller than value of parent node tagtree3d(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx+1,skip)   }    if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and value of all other child nodes are smaller than value of parentnode tagtree3d(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx,skip)   }    if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx+1] existin next depth){     if(depth>=start_depth)      skip=this is the lastchild node and value of all other child nodes are smaller than value ofparent node tagtree3d(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx+1,skip)   }    return   }  map[z_idx][y_idx][x_idx]=rmap[depth][z_idx][y_idx][x_idx]  }  ...... }nzflag_index non-zero flag of the index index index value delta_indexindex value = parent node index value + delta_index nzflag_q non-zefoflag of the quantized coefficient abs_q absolute value of quantizedcoefficient delta_abs_q absolute value of quantized coefficient = parentnode value + delta_abs_q sign_q sign bit of the quantized coefficient

-   -   nzflag_index non-zero flag of the index    -   index index value    -   delta_index index value=parent node index value+delta_index    -   nzflag_q non-zefo flag of the quantized coefficient    -   abs_q absolute value of quantized coefficient    -   delta_abs_q absolute value of quantized coefficient=parent node        value+delta_abs_q

sign_q sign bit of the quantized coefficient

Escape Coding

In a codebook coding method, an escape index is a special index in whicha coefficient that is represented by the escape index can have differentquantized coefficient values. The quantized coefficient values for allescape indices need to be encoded in a bitstream explicitly.

After 3D-Octree or 3D-Tagtree coding is completed, an escape codingprocedure is launched if a codebook coding method is used. All codebookindices are scanned, and if an escape index is found, a non-zero flag ofa corresponding quantized coefficient value is encoded. If thecoefficient value is not zero, a sign bit followed by the absolute valueof the quantized coefficient value are encoded.

An example of a corresponding syntax table is listed below in Table 14:

TABLE 14 escape( ){  ......  if(codebook_size)  for(z=0;z<cu_cdepth;++z)    for(y=0;y<cu_height;++y)    for(x=0;x<cu_width:++x)      if(map[z][y][x]==codebook_size){      q=0       nzflag       if(nzflag){        sign        abs_q       q=(sign?-int(abs_q):abs_q)       }      }  ...... } nzflagnon-zero flag sign sign bit abs_q quantized coefficientq=(sign?-int(abs_q):abs_q)

-   -   nzflag non-zero flag    -   sign sign bit    -   abs_q quantized coefficient q=(sign?-int(abs_q):abs_q)

CTU3D Header

An encoding algorithm is applied to use both a 3D-Octree method and a3D-tagteee method, and one mode with a better RD is chosen as thewinner. A mode decision is recorded, and a ctu3d_map_mode_flag isdefined to indicate if all CU3Ds in this CTU3D share the same map_mode.An enable_start_depth is also defined to indicate if CU3D encoding canstart from a depth other than a bottom depth.

An example of a corresponding syntax table is listed below in Tables 15and 16:

TABLE 15 ctu3d( ){  ......  ctu3d_header( )  cu3d(0,0,0)  ...... }

TABLE 16 ctu3d_header( ){  ......  ctu3d_map_mode_flag if(!ctu3d_map_mode_flag)   map_mode  enable_start_depth  ...... }

ctu3d_map_mode_flag being 0 indicates that each cu3d use its ownmap_mode, and ctu3d_map_mode_flag being 1 indicates that all cu3d shareone map_mode.

map_mode being 0 indicates that a 3D-Octree coding method is selected,and map_mode being 1 indicates that a 3D-Tagtree coding method isselected.

enable_start_depth being 0 indicates cu3d encoding always start at abottom depth, and enable_start_depth being 1 indicates that cu3dencoding can start from a depth other than the bottom depth.

Mode Decision

An encoding algorithm is applied to use both a 3D-Octree method and a3D-tagteee method, and one mode with a better RD is chosen as thewinner. A mode decision is recorded in a CU3D syntax section. Anencoding_start_depth is also recorded in the CU3D syntax section.

An example of a corresponding syntax table is listed below in Table 17:

TABLE 17 cu3d(depth,y_idx,x_idx){  ......  if(ctu3d_map_mode_flag)  map_mode  start_depth_delta=0  if(enable_start_depth)  start_depth_delta  start_depth=total_depth−1−start_depth_delta if(map_mode==0)   octree3d(start_depth,0,0,0,0,false) elseif(map_mode==1)   tagtree3d(start_depth,0,0,0,0,false)  escape( ) ...... } map_mode being 0 indicates that a 3D-Octree method isselected, and map_mode being 1 indicates that a 3D-Tagtree method isselected. start_depth_delta start_depth=total_depth−1−start_depth_delta

map_mode being 0 indicates that a 3D-Octree method is selected, andmap_mode being 1 indicates that a 3D-Tagtree method is selected.

start_depth_delta start_depth=total_depth-1-start_depth_delta

3D-Unitree Coding

If a node value for a 3D-Octree location at another depth is defined asa maximum value of its eight child nodes, the node value that equals tozero indicates that all its child nodes (and their child nodes,including nodes at a last depth) have identical values of zero. A valueof zero of a node at the last depth indicates that a correspondingcodebook index or coefficient is zero as well.

In embodiments, the above requirement is relaxed so that theaforementioned identical value can be any value, not just zero.

A 3D-Unitree for a CU3D is constructed as follows. A node value of 1 fora 3D-Unitree location at a depth other than a last depth indicates thatits child nodes (and their child nodes, including nodes at the lastdepth) have non-unified (different) values. A node value of 0 for a3D-Unitree location at a depth other than the last depth indicates thatall its child nodes (and their child nodes, including nodes at the lastdepth) have unified (identical) values.

For nodes at a last depth that have the same parent node, a value of 1is assigned to these nodes, if codebook indices (if a codebook codingmethod is used) or an absolute value of coefficients (if a directquantization coding method is used) in a corresponding CU3D havenon-unified values. A value of 0 is assigned to these nodes, if thecodebook indices (if the codebook coding method is used) or the absolutevalue of the coefficients (if the direct quantization coding method isused) in the corresponding CU3D have unified values of any valuesincluding zero.

After the 3D-Unitree is constructed, all nodes are scanned using apredefined scan order to encode respective node values.

In one embodiment, starting from a top node, a depth-first-search isused to scan all child nodes. A scan order for child nodes that sharethe same parent node can be defined arbitrarily, such as(0,0,0)→(0,0,1)→(0,1,0)→(0,1,1)→(1,0,0)→(1,0,1)→(1,1,0)→(1,1,1).

In another embodiment, starting from a top node, a breadth-first-searchis used to scan all child nodes. A scan order for child nodes that sharethe same parent node can be defined arbitrarily, such as(0,0,0)→(0,0,1)→(0,1,0)→(0,1,1)→(1,0,0)→(1,0,1)→(1,1,0)→(1,1,1).

To have a compact representation of a bitstream, after a value of agiven node is encoded, its corresponding unified value is also encodedif the node value is zero, but scanning and encoding of its child nodes(and their child nodes) is skipped as their values should always equalto a unified value.

An encoding_start_depth is defined to indicate a first depth thatparticipates in encoding process. When all nodes are scanned using apredefined scan order, encoding of a current node value is skipped if adepth of this node is above encoding_start_depth.

If a node at a last depth is reached, if encoding_start_depth is thelast depth or its parent node value is not zero, its correspondingcodebook index or coefficient is encoded into a bitstream. Otherwise, ifa direct quantization coding method is used and its correspondingunified value is not zero, a sign bit of the coefficient is encoded intothe bitstream.

For some CU3Ds with different depths/heights/widths, there are notenough coefficients to construct a complete 3D-Octree in which allparent nodes have all eight child nodes available. Scanning and encodingof these non-exist child nodes are skipped if a parent node does nothave all eight child nodes.

An example of a corresponding syntax table is listed below in Table 18:

TABLE 18 unitree3d(start_depth,depth,z_idx,y_idx,x_idx,skip){  ...... if(depth<total_depth−1){   nzflag=utree[depth][z_idx][y_idx][x_idx]=0  if(depth>=start_depth){    if(!skip){     nzflag    utree[depth][z_idx][y_idx][x_idx]=nzflag     if(!nzflag){     map_nzflag      if(map_nzflag){       if(codebook_size){       cmap_val        map_val=cmap_val       }else{        qmap_val       map_val=qmap_val       }      }     }    }   }  next_z_idx=(z_idx<<1)   next_y_idx=(y_idx<<1)   next_x_idx=(x_idx<<1)  bskip=(depth>=start_depth)?!nzflag:false;   if(location [next_z_idx][next_y_idx][ next_x_idx] exist in next depth) unitree3d(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx,bskip)  if(location [next_z_idx][ next_y_idx][ next_x_idx+1] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx+1,bskip)  if(location [next_z_idx][ next_y_idx+1][ next_x_idx] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx,bskip)  if(location [next_z_idx][ next_y_idx+1][ next_x_idx+1] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx+1,bskip)  if(location [next_z_idx+1][ next_y_idx][ next_x_idx] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx,bskip)  if(location [next_z_idx+1][ next_y_idx][ next_x_idx+1] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx+1,bskip)  if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx,bskip)  if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx+1] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx+1,bskip)  return  }  if(start_depth=total_depth−1 || utree[depth−1][z_idx>>1][y_idx>>1][x_idx>>1]){   map_nzflag   if(map_nzflag){   if(codebook_size){     index     map[z_idx][y_idx][x_idx]=index   }else{     sign     abs_q    map[z_idx][y_idx][x_idx]=(sign?-int(abs_q):abs_q)    }   }  }else{  sign=0   if(!codebook_size && map_val)    map_sign  map[z_idx][y_idx][x_idx]=(sign?-int(map_val):map_val)  }  ...... }nzflag utree node value map_nzflag non-zero flag of the unified valuecmap_val index value of the unified value qmap_val absolute value of theunified quantized coefficient index index value sign sign bit of thequantized coefficient abs_q absolute value of the quantized coefficientmap_sign sign bit of the unified quantized coefficient

CTU3D Header

An encoding algorithm is applied to use both a 3D-Octree method and a3D-tagteee method, and a 3D-Unitree method is also applied when usingthe 3D-Octree method. One mode with a better RD is chosen as the winner.A mode decision is recorded, and a ctu3d_map_mode_flag is defined toindicate if all CU3Ds in this CTU3D share the same map_mode. Anenable_start_depth is also defined to indicate if CU3D encoding canstart from a depth other than a bottom depth.

Mode Decision

An encoding algorithm is applied to use both a 3D-Octree method and a3D-tagteee method, and a 3D-Unitree method is also applied when usingthe 3D-Octree method. One mode with a better RD is chosen as the winner.A mode decision is recorded in a CU3D syntax section.

An example of a corresponding syntax table is listed below in Table 19:

TABLE 19 cu3d(depth,y_idx,x_idx){  ......  if(ctu3d_map_mode_flag)  map_mode  start_depth_delta=0  if(enable_start_depth)  start_depth_delta  start_depth=total_depth−1−start_depth_delta if(map_mode==0){   uni_mode   if(uni_mode)   unitree3d(start_depth,0,0,0,0,false)   else   octree3d(start_depth,0,0,0,0,false)  }else if(map_mode==1)  tagtree3d(start_depth,0,0,0,0,false)  ...... } map_mode being 0indicates that a 3D-Octree method is selected, and map_mode being 1indicates that a 3D-Tagtree method is selected. start_depth_deltastart_depth=total_depth−1−start_depth_delta uni_mode being 0 indicatesthat a 3D-Octree method is selected, and uni_mode being 1 indicates thata 3D-Unitree method is selected.

Modification in 3D-Tree Coding Method

In an original disclosure, tree[z][y][x] is used to access location[z][y][x] at a last depth of a 3D-Tree (3D-Octree, 3D-Unitree or3D-Tagtree), and map[z][y][x] is used to access an index map of a CU3D.

Because zdep_array[n] represents an original n^(th) 2D plane before akernel plane reorder operation, the kernel plane reorder operationrequires that a z-axis is indexed by the zdep_array[n] instead of n.

In embodiments, a z-axis access for an encoding method is modified sothat tree[zdep_array[z]][y][x] is used to access location [z][y][x] at alast depth of a 3D-Tree (3D-Octree, 3D-Unitree or 3D-Tagtree), andmap[zdep_array[z]][y][x] is used to access an index map of a CU3D.

An example of a corresponding syntax table modification is listed belowin Tables 20 and 21:

TABLE 20 Original syntax tableunitree3d(start_depth,depth,z_idx,y_idx,x_idx,skip){  ...... if(depth<total_depth−1){   nzflag=utree[depth][z_idx][y_idx][x_idx]=0  if(depth>=start_depth){    if(!skip){     nzflag    utree[depth][z_idx][y_idx][x_idx]=nzflag     if(!nzflag){     map_nzflag      if(map_nzflag){       if(codebook_size){       cmap_val        map_val=cmap_val       }else{        qmap_val       map_val=qmap_val       }      }     }    }   }  next_z_idx=(z_idx<<1)   next_y_idx=(y_idx<<1)   next_x_idx=(x_idx<<1)  bskip=(depth>=start_depth)?!nzflag:false;   if(location [next_z_idx][next_y_idx][ next_x_idx] exist in next depth) unitree3d(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx,bskip)  if(location [next_z_idx][ next_y_idx][ next_x_idx+1] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx+1,bskip)  if(location [next_z_idx][ next_y_idx+1][ next_x_idx] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx,bskip)  if(location [next_z_idx][ next_y_idx+1][ next_x_idx+1] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx+1,bskip)  if(location [next_z_idx+1][ next_y_idx][ next_x_idx] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx,bskip)  if(location [next_z_idx+1][ next_y_idx][ next_x_idx+1] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx+1,bskip)  if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx,bskip)  if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx+1] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx+1,bskip)  return  }  if(start_depth=total_depth−1 || utree[depth−1][z_idx>>1][y_idx>>1][x_idx>>1]){   map_nzflag   if(map_nzflag){   if(codebook_size){     index     map[z_idx][y_idx][x_idx]=index   }else{     sign     abs_q    map[z_idx][y_idx][x_idx]=(sign?-int(abs_q):abs_q)    }   }  }else{  sign=0   if(!codebook_size && map_val)    map_sign  map[z_idx][y_idx][x_idx]=(sign?-int(map_val):map_val)  }  ...... }

To address a 2D plane at a last depth, a variable zs_idx is defined asnew z_idx.

TABLE 21 Modified syntax tableunitree3d(start_depth,depth,z_idx,y_idx,x_idx,skip){  ...... zs_idx=(depth==total_depth−1)?zdep_array[z_idx]:z_idx if(depth<total_depth−1){   nzflag=utree[depth][z_idx][y_idx][x_idx]=0  if(depth>=start_depth){    if(!skip){     nzflag    utree[depth][zs_idx][y_idx][x_idx]=nzflag     if(!nzflag){     map_nzflag      if(map_nzflag){       if(codebook_size){       cmap_val        map_val=cmap_val       }else{        qmap_val       map_val=qmap_val       }      }     }    }   }  next_z_idx=(z_idx<<1)   next_y_idx=(y_idx<<1)   next_x_idx=(x_idx<<1)  bskip=(depth>=start_depth)?!nzflag:false;   if(location [next_z_idx][next_y_idx][ next_x_idx] exist in next depth) unitree3d(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx,bskip)  if(location [next_z_idx][ next_y_idx][ next_x_idx+1] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx+1,bskip)  if(location [next_z_idx][ next_y_idx+1][ next_x_idx] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx,bskip)  if(location [next_z_idx][ next_y_idx+1][ next_x_idx+1] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx+1,bskip)  if(location [next_z_idx+1][ next_y_idx][ next_x_idx] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx,bskip)  if(location [next_z_idx+1][ next_y_idx][ next_x_idx+1] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx+1,bskip)  if(location [next_z_idx+1][next_y_idx+1][next_x_idx] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx,bskip)  if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx+1] exist in nextdepth) unitree3d(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx+1,bskip)  return  }  if(start_depth=total_depth−1 || utree[depth−1][z_idx>>1][y_idx>>1][x_idx>>1]){   map_nzflag   if(map_nzflag){   if(codebook_size){     index     map[zs_idx][y_idx][x_idx]=index   }else{     sign     abs_q    map[zs_idx][y_idx][x_idx]=(sign?-int(abs_q):abs_q)    }   }  }else{  sign=0   if(!codebook_size && map_val)    map_sign  map[zs_idx][y_idx][x_idx]=(sign?-int(map_val):map_val)  }  ...... }

In further embodiments, an additional 3D-Tagtree mode, a correspondingflag and a corresponding encoding method are used to encode a CU3D.

3D-Tagtree Mode Decision

As described above, one version of a 3D-Tagtree is that a node value fora 3D-Tagtree location is defined as a maximum value of its eight childnodes (tagtree3d). Another version of a 3D-Tagtree is that a node valuefor a 3D-Tagtree location is defined as a minimum value of its eightchild nodes (tagtree3dm). One of the two versions of a 3D-Tagteee isused to encode a CU3D.

In alternative embodiments, both versions of a 3D-Tagtree is used toencode the CU3D, and a candidate with a best RD is chosen as the winner.

In detail, an encoding algorithm may use both a 3D-Octree method and a3D-tagteee method. A 3D-Unitree method is applied when the 3D-Octreemethod is used, and both versions of the 3D-Tagteee method is appliedwhen the 3D-Tagtree method is used. A mode with a better RD is chosen asthe winner, and a mode decision is recorded in a cu3d syntax section.

An example of a corresponding syntax table for a tagtree3d mode decisionis listed below in Table 22:

TABLE 22 cu3d(depth,y_idx,x_idx){  ......  if(ctu3d_map_mode_flag)  map_mode  start_depth_delta=0  if(enable_start_depth)  start_depth_delta  start_depth=total_depth−1−start_depth_delta if(map_mode==0){   uni_mode   if(uni_mode)   unitree3d(start_depth,0,0,0,0,false)   else   octree3d(start_depth,0,0,0,0,false)  }else if(map_mode==1){  tgt_mode   if(tgt_mode)    tagtree3dm(start_depth,0,0,0,0,false)  else    tagtree3d(start_depth,0,0,0,0,false)  }  ...... } map_modebeing 0 indicates that an Octree method is selected, and map-mode being1 indicates that a Tagtree3d method is selected. start_depth_deltastart_depth=total_depth−1−start_depth_delta uni_mode being 0 indicatesthat the Octree method is selected, and uni_mode being 1 indicates thatan Unitree3d method is selected. tgt_mode being 0 indicates that aTagtree3d method version 1 is selected, and tgt_mode being 1 indicatesthat a Tagtree3d method version 2 is selected.

An example of a corresponding syntax table for a tagtree3d coding method1 is listed below in Table 23:

TABLE 23 tagtree3d(start_depth,depth,z_idx,y_idx,x_idx,skip){  ...... proceed=nzflag=1  if(depth)  rmap[depth][z_idx][y_idx][x_idx]=rmap[depth−1] [z_idx>>1][y_idx>>1][x_idx>>1]  if(depth>=start_depth){   if(!skip){   if(codebook_size){     if(depth==start_depth){      index=0     nzflag_index      if(nzflag_index)       index     rmap[depth][z_idx][y_idx][x_idx]=index     }else{      delta_index     rmap[depth][z_idx][y_idx][x_idx]=       rmap[depth−1][z_idx>>1][y_idx>>1][x_idx>>1]−delta_index     }    }else{    if(depth==start_depth){      abs_q=0      nzflag_q      if(nzflag_q)      abs_q      rmap[depth][z_idx][y_idx][x_idx]=abs_q     }else{     delta_abs_q      rmap[depth][z_idx][y_idx][x_idx]=      rmap[depth− 1][z_idx>>1][y_idx>>1][x_idx>>1]−delta_abs_q     }   }    nzflag=(rmap[depth][z_idx][y_idx][x_idx]!=0)   }  if(depth==total_depth−1&nzflag&&codebook_size==0){    sign_q   rmap[depth][z_idx][y_idx][x_idx]=     (sign?-int(rmap[depth][z_idx][y_idx][x_idx]):rmap[depth][z_idx][y_idx][x_idx])  }   proceed=nzflag  }  if(proceed){   if(depth<total_depth−1){   skip=false    next_z_idx=(z_idx<<1)    next_y_idx=(y_idx<<1)   next_x_idx=(x_idx<<1)    if(location [next_z_idx][ next_y_idx][next_x_idx] exist in next depth){ tagtree3d(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx,skip)   }    if(location [next_z_idx][ next_y_idx][ next_x_idx+1] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and value of all other child nodes are smaller than value of parentnode tagtree3d(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx+1,skip)   }    if(location [next_z_idx][ next_y_idx+1][ next_x_idx] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and value of all other child nodes are smaller than value of parentnode tagtree3d(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx,skip)   }    if(location [next_z_idx][ next_y_idx+1][ next_x_idx+1] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and value of all other child nodes are smaller than value of parentnode tagtree3d(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx+1,skip)   }    if(location [next_z_idx+1][ next_y_idx][ next_x_idx] exist innext depth)     if(depth>=start_depth)      skip=this is the last childnode and value of all other child nodes are smaller than value of parentnode tagtree3d(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx,skip)   if(location [next_z_idx+1][ next_y_idx][ next_x_idx+1] exist in nextdepth){     if(depth>=start_depth)      skip=this is the last child nodeand value of all other child nodes are smaller than value of parent node tagtree3d(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx+1,skip)   }    if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx] exist innext depth){     if(depth>=start_depth)      skip=this is the last childnode and value of all other child nodes are smaller than value of parentnode tagtree3d(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx,skip)   }    if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx+1] existin next depth){     if(depth>=start_depth)      skip=this is the lastchild node and value of all other child nodes are smaller than value ofparent node tagtree3d(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx+1,skip)   }    return   }  map[z_idx][y_idx][x_idx]=rmap[depth][z_idx][y_idx][x_idx]  }  ...... }nzflag_index non-zefo flag of the index index index value delta_indexindex value = parent node index value − delta_index nzflag_q non-zefoflag of the quantized coefficient abs_q absolute value of quantizedcoefficient delta_abs_q absolute value of quantized coefficient = parentnode value − delta_abs_q sign_q sign bit of the quantized coefficient

An example of a corresponding syntax table for a tagtree3d coding method2 is listed below in Table 24:

TABLE 24 tagtree3dm(start_depth,depth,z_idx,y_idx,x_idx,skip){  ...... if(depth)   rmap[depth][z_idx][y_idx][x_idx]=rmap[depth−1] [z_idx>>1][y_idx>>1][x_idx>>1]  if(depth>=start_depth){   if(!skip){   if(codebook_size){     if(depth==start_depth){      index=0     nzflag_index      if(nzflag_index)       index     rmap[depth][z_idx][y_idx][x_idx]=index     }else{      delta_index     rmap[depth][z_idx][y_idx][x_idx]=       rmap[depth−1][z_idx>>1][y_idx>>1][x_idx>>1]+delta_index     }    }else{    if(depth==start_depth){      abs_q=0      nzflag_q      if(nzflag_q)      abs_q      rmap[depth][z_idx][y_idx][x_idx]=abs_q     }else{     delta_abs_q      rmap[depth][z_idx][y_idx][x_idx]=      rmap[depth− 1][z_idx>>1][y_idx>>1][x_idx>>1]+delta_abs_q     }   }   }   nzflag=(rmap[depth][z_idx][y_idx][x_idx]!=0)  if(depth==total_depth−1&nzflag&&codebook_size==0){    sign_q   rmap[depth][z_idx][y_idx][x_idx]=     (sign?-int(rmap[depth][z_idx][y_idx][x_idx]):rmap[depth][z_idx][y_idx][x_idx])  }  }  if(depth<total_depth−1){   next_z_idx=(z_idx<<1)  next_y_idx=(y_idx<<1)   next_x_idx=(x_idx<<1)   if(location[next_z_idx][ next_y_idx][ next_x_idx] exist in next depth){ tagtree3dm(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx,skip)  }   if(location [next_z_idx][ next_y_idx][ next_x_idx+1] exist in nextdepth){    if(depth>=start_depth)     skip=this is the last child nodeand value of all other child nodes are bigger than  value of parent node tagtree3dm(start_depth,depth+1,next_z_idx,next_y_idx,next_x_idx+1,skip)  }   if(location [next_z_idx][ next_y_idx+1][ next_x_idx] exist in nextdepth){    if(depth>=start_depth)     skip=this is the last child nodeand value of all other child nodes are bigger than  value of parent node tagtree3dm(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx,skip)  }   if(location [next_z_idx][ next_y_idx+1][ next_x_idx+1] exist innext depth){    if(depth>=start_depth)     skip=this is the last childnode and value of all other child nodes are bigger than  value of parentnode tagtree3dm(start_depth,depth+1,next_z_idx,next_y_idx+1,next_x_idx+1,skip)  }   if(location [next_z_idx+1][ next_y_idx][ next_x_idx] exist in nextdepth)    if(depth>=start_depth)     skip=this is the last child nodeand value of all other child nodes are bigger than  value of parent node tagtree3dm(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx,skip)  if(location [next_z_idx+1][ next_y_idx][ next_x_idx+1] exist in nextdepth){    if(depth>=start_depth)     skip=this is the last child nodeand value of all other child nodes are bigger than  value of parent node tagtree3dm(start_depth,depth+1,next_z_idx+1,next_y_idx,next_x_idx+1,skip)  }   if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx] exist innext depth){    if(depth>=start_depth)     skip=this is the last childnode and value of all other child nodes are bigger than  value of parentnode tagtree3dm(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx,skip)  }   if(location [next_z_idx+1][ next_y_idx+1][ next_x_idx+1] exist innext depth){    if(depth>=start_depth)     skip=this is the last childnode and value of all other child nodes are bigger than  value of parentnode tagtree3dm(start_depth,depth+1,next_z_idx+1,next_y_idx+1,next_x_idx+1,skip)  }   return  }  ...... } nzflag_index non-zefo flag of the index indexindex value delta_index index value = parent node index value +delta_index nzflag_q non-zefo flag of the quantized coefficient abs_qabsolute value of quantized coefficient delta_abs_q absolute value ofquantized coefficient = parent node value + delta_abs_q sign_q sign bitof the quantized coefficient

In further embodiments, an additional 3D-Tagtree mode, a correspondingflag and a corresponding encoding method are used to encode a CU3D.

Combined 3D Unitree and Tagtree Coding

Unified coefficients and non-unified coefficients can co-exist in oneCU3D, so a combination of a 3D-Unitree coding method and a 3D-Tagtreecoding method can be used to encode such a CU3D.

Both a 3D-Tagtree and a 3D-Unitree are constructed using 3D-Tagtree and3D-Unitree construction methods. After the 3D-Tagtree and 3D-Unitree areconstructed, all nodes are scanned using a predefined scan order toencode respective node values.

In one embodiment, starting from a top node, a depth-first-search isused to scan all child nodes. A scan order for the child nodes thatshare the same parent node can be defined arbitrarily, such as(0,0,0)→(0,0,1)→(0,1,0)→(0,1,1)→(1,0,0)→(1,0,1)→(1,1,0)→(1,1,1).

In another embodiment, starting from a top node, a breadth-first-searchis used to scan all child nodes. A scan order for the child nodes thatshare the same parent node can be defined arbitrarily, such as(0,0,0)→(0,0,1)→(0,1,0)→(0,1,1)→(1,0,0)→(1,0,1)→(1,1,0)→(1,1,1).

To have a compact representation of a bitstream, a value of a given nodefrom a 3D-Unitree is encoded first. If the 3D-Unitree node value iszero, its corresponding unified value is encoded, and scanning andencoding of its child nodes (and their child nodes) are skipped as theirvalues should always be equal to a unified value. If the 3D-Unitree nodevalue is not zero, a 3D-Tagtree coding method is used to encode either a3D-Tagtree value if a node is a top node that does not have a parentnode or a difference of 3D-Tagtree values between a parent node and thischild node. Node skipping methods introduced in the above Tagtree codingsection are adopted as well.

An encoding_start_depth is defined to indicate a first depth thatparticipate in an encoding process. When all nodes are scanned using apredefined scan order, encoding of a current node value is skipped if adepth of this node is above encoding_start_depth.

If a node at a last depth is reached, and if a value of a node at abottom depth is not zero and a direct quantization coding method isused, a sign bit of its corresponding non-zero coefficient is encoded.

For some CU3Ds with different depths/heights/widths, there are notenough coefficients to construct a complete 3D-Octree in which allparent node have all eight child nodes available. Scanning and encodingof these non-exist child nodes are skipped if a parent node does nothave all eight child nodes.

Combined 2D Unitree and Tagtree Coding

In embodiments, the aforementioned combined 3D Unitree and Tagtreecoding is used to encode a CU3D. In further embodiments, instead ofusing a 3D-Octree structure, a sequence of 2D planes is encodedindependently, and for each independent 2D plane, a Quadtree structureis used to construct a 2D-Unitree and a 2D-Tagtree.

An Octree structure is used to represent a 3D-Tagtree and a 3D-Unitree.In these embodiments, a Quadtree structure is used to represent a2D-Tagtree and a 2D-Unitree. The 2D-Tagtree and 2D-Unitree areconstructed using the same principle as a 3D-Tagtree and a 3D-Unitree.

After the 2D-Tagtree and 2D-Unitree are constructed, all nodes arescanned using a predefined scan order to encode respective node values.

In one embodiment, starting from a top node, a depth-first-search isused to walk through all child nodes. A scan order for the child nodesthat share the same parent node can be defined arbitrarily, such as(0,0)→(0,1)→(1,0)→(1,1).

In another embodiment, starting from a top node, a breadth-first-searchis used to scan all child nodes. A scan order for child nodes that sharethe same parent node can be defined arbitrarily, such as(0,0)→(0,1)→(1,0)→(1,1).

To have a compact representation of a bitstream, a value of a given nodefrom Unitree first is encoded first. If the Unitree node value is zero,its corresponding unified value is encoded, and scanning and encoding ofits child nodes (and their child nodes) are skipped as their valueshould always equal to a unified value. If the Unitree node value is notzero, a Tagtree coding method is used to encode either a Tagtree valueif a node is top node that does not have a parent node or a differenceof Tagtree values between a parent node and this child node. Nodeskipping methods introduced in the above Tagtree coding section areadopted as well.

An encoding_start_depth is defined to indicate a first depth thatparticipate in encoding process. When all nodes are scanned using apredefined scan order, encoding of a current node value is skipped if adepth of this node is above encoding_start_depth.

If a node at a last depth is reached, and if a value of a node at abottom depth is not zero and a direct quantization coding method isused, a sign bit of its corresponding non-zero coefficient is encoded.

After encoding of one 2D plane is completed, a next 2D plane starts tobe encoded. The process is repeated until a last 2D plane is encoded.

For some CU3Ds with different heights/widths, there are not enoughcoefficients to construct a complete 2D-Quadtree in which all parentnode have all four child nodes available. Scanning and encoding of thesenon-exist child nodes are skipped if a parent node does not have allfour child nodes.

Mode Decision

Along with other coding methods, a combined Unitree and Tagtree codingmethod may be used to encode a CU3D, and a candidate with the best RDamong all of the coding methods is chosen as the winner.

In detail, an encoding algorithm uses both a 3D-Octree method and a3D-Tagtree method. A 3D-Unitree method is applied when the 3D-Octreemethod is used, and a Combined-Unitree-Tagtree method is applied whenthe 3D-Tagtree method is used. A mode with a better RD among the3D-Octree method and the 3D-Tagtree method is chosen as the winner, anda mode decision is recorded in a cu3d syntax section.

An example of a corresponding syntax table for a tagtree3d mode decisionis listed below in Table 25:

TABLE 25 cu3d(depth,y_idx,x_idx){  ......  if(ctu3d_map_mode_flag)  map_mode  start_depth_delta=0  if(enable_start_depth)  start_depth_delta  start_depth=total_depth−1−start_depth_delta cbook_esc_mode=0  if(enable_escape_reorder)   cbook_esc_mode if(map_mode==0){   uni_mode   if(uni_mode)   unitree3d(start_depth,0,0,0,0,false)   else   octree3d(start_depth,0,0,0,0,false)  }else if(map_mode==1){  tgt_mode   if(tgt_mode)    tagtree3d(start_depth,0,0,0,0,false)   else   for(z=0;z<zdep_size;++z)    uni_tagtree3d(start_depth,0,z,0,0,false,false)  }  ...... } map_modebeing 0 indicates that an Octree method is selected, and map_mode being1 indicates that a Tagtree3d method is selected. start_depth_deltastart_depth=total_depth−1−start_depth_delta cbook_esc_mode being 0indicates that an escape is not reordered, and cbook_esc_mode being 1indicates that the escape is reordered. uni_mode being 0 indicates thatthe Octree method is selected, and uni_mode being 1 indicates that aUnitree3d method is selected. tgt_mode being 0 indicates that auni_tgtree3d method is selected, and tgt_mode being 1 indicates that theTagtree3d method is selected.

An example of a corresponding syntax table for a uni_tagtree3d codingmethod is listed below in Table 26:

TABLE 26uni_tagtree3d(start_depth,depth,z_idx,y_idx,x_idx,uni_skip,tgt_skip){ ......  zs_idx=(depth==total_depth−1)?zdep_array[z_idx]:z_idx uniflag=tgt[depth][zs_idx][y_idx][x_idx][0]=0  if(depth)  tgt[depth][zs_idx][y_idx][x_idx][1]=tgt[depth−1][z_idx>>1][y_idx>>1][x_idx>>1][1]  if(depth>=start_depth){  if(!uni_skip){    if(start_depth<total_depth−1 || ((y_idx&1)==0 &&(x_idx&1)==0)){     nzflag_uni    }else{    nzflag_uni=tgt[depth][zs_idx][y_idx&(~1)][x_idx&(~1)][0] tgt[depth][zs_idx][y_idx][x_idx][1]=abs(tgt[depth][zs_idx][y_idx&(~1)][x_idx&(~1)][1])   }    uniflag=tgt[depth][zs_idx][y_idx][x_idx]=nzflag_uni   if(!tgt_skip &&     (start_depth<total_depth−1 || (((y_idx&1)==0 &&(x_idx&1)==0) || uniflag))) {     if(codebook_size){     if(depth==start_depth){       index=0       nzflag_index      if(nzflag_index)        index      tgt[depth][zs_idx][y_idx][x_idx][1]=index      }else{      delta_index       tgt[depth][zs_idx][y_idx][x_idx][1]=       tgt[depth−  1][zs_idx>>1][y_idx>>1][x_idx>>1][1]+delta_index     }     }else{      if(depth==start_depth){       abs_q=0      nzflag_q       if(nzflag_q)        abs_q      tgt[depth][zs_idx][y_idx][x_idx][1]=abs_q      }else{      delta_abs_q       tgt[depth][zs_idx][y_idx][x_idx][1]=       tgt[depth−  1][zs_idx>>1][y_idx>>1][x_idx>>1][1]+delta_abs_q     }     }    }   }   nzflag=(tgt[depth][zs_idx][y_idx][x_idx][1]!=0)  if(depth==total_depth−1&nzflag&&codebook_size==0){    sign_q   tgt[depth][zs_idx][y_idx][x_idx][1]=     (sign?-int(tgt[depth][zs_idx][y_idx][x_idx][1]):tgt[depth][zs_idx][y_idx][x_idx][1])  }  }  if(depth<total_depth−1){   next_y_idx=(y_idx<<1)  next_x_idx=(x_idx<<1)   uskip=(depth>=start_depth)?!uniflag:false  if(location [z_idx][next_y_idx][next_x_idx] exist in next depth){ uni_tagtree3d(start_depth,depth+1,z_idx,next_y_idx,next_x_idx,uskip,false)  }   if(location [z_idx][next_y_idx][next_x_idx+1] exist in nextdepth){    if(depth>=start_depth)     tskip=this is the last child nodeand value of all other child nodes are bigger than value of parent node uni_tagtree3d(start_depth,depth+1,z_idx,next_y_idx,next_x_idx+1,uskip,tskip)  }   if(location [z_idx][next_y_idx+1][next_x_idx] exist in nextdepth){    if(depth>=start_depth)     tskip=this is the last child nodeand value of all other child nodes are bigger than value of parent node uni_tagtree3d(start_depth,depth+1,z_idx,next_y_idx+1,next_x_idx,uskip,tskip)  }   if(location [z_idx][next_y_idx+1][next_x_idx+1] exist in nextdepth){    if(depth>=start depth)     tskip=this is the last child nodeand value of all other child nodes are bigger than value of parent node uni_tagtree3d(start_depth,depth+1,z_idx,next_y_idx+1,next_x_idx+1,uskip,tskip)  }   return  } map[zs_idx][y_idx][x_idx]=tgt[depth][zs_idx][y_idx][x_idx][1]  ...... }nzflag_uni utree node value nzflag_index non-zero flag of index indexindex value delta_index index value = parent node index value +delta_index nzflag_q non-zero flag of quantized coefficient abs_qabsolute value of quantized coefficient delta_abs_q absolute value ofquantized coefficient = parent node value + delta_abs_q sign_q sign bitof quantized coefficient

FIG. 7 is a flowchart of a method 700 of adaptive block partitioning forneural network model compression, according to embodiments. In someimplementations, one or more process blocks of FIG. 7 may be performedby the platform 220. In some implementations, one or more process blocksof FIG. 7 may be performed by another device or a group of devicesseparate from or including the platform 220, such as the user device210.

As shown in FIG. 7 , in operation 710, the method 700 includes reshapinga four-dimensional (4D) parameter tensor of a neural network into 3Dparameter tensor of the neural network, the 3D parameter tensorincluding a convolution kernel size, an input feature size and an outputfeature size

In operation 720, the method 700 includes partitioning the 3D parametertensor along a plane that is formed by the input feature size and theoutput feature size, into 3D coding tree units (CTU3Ds).

In operation 730, the method 700 includes partitioning each of theCTU3Ds into a plurality of 3D coding units (CU3Ds) recursively until amaximum depth, using a quad-tree. Note that the maximum depth can bezero, which indicates that no partition of CTU3D to CU3Ds is needed.

In operation 740, the method 700 includes constructing a 3D-Tree foreach of the plurality of CU3Ds.

In operation 750, the method 700 includes entropy encoding each of aplurality of values of a plurality of nodes of the 3D-Tree.

The 3D-Tree may be a 3D-Octree. Based on a codebook index or coefficientof a respective one of the plurality of CU3Ds being other than zero, avalue of a node included in a last depth of the 3D-Octree may be 1.Based on the codebook index or coefficient of the respective one of theplurality of CU3Ds being zero, the value of the node included in thelast depth of the 3D-Octree may be 0. A value of a parent node atanother depth of the 3D-Octree may be a maximum or minimum value ofchild nodes of the parent node.

The 3D-Tree may be a 3D-Tagtree. Based on an absolute value of acodebook index or coefficient of a respective one of the plurality ofCU3Ds being other than zero, a value of a node included in a last depthof the 3D-Tagtree may be 1. Based on the absolute value of the codebookindex or coefficient of the respective one of the plurality of CU3Dsbeing zero, the value of the node included in the last depth of the3D-Tagtree may be 0. A value of a parent node at another depth of the3D-Tagtree may be a maximum value of child nodes of the parent node.

The method 700 may further include constructing another 3D-Tagtree foreach of the plurality of CU3Ds. Based on the absolute value of thecodebook index or coefficient of the respective one of the plurality ofCU3Ds being other than zero, a value of a node included in a last depthof the other 3D-Tagtree may be 1. Based on the absolute value of thecodebook index or coefficient of the respective one of the plurality ofCU3Ds being zero, the value of the node included in the last depth ofthe other 3D-Tagtree may be 0. A value of a parent node at another depthof the other 3D-Tagtree may be a minimum value of child nodes of theparent node of the other 3D-Tagtree. The method 700 may further includeentropy encoding each of a plurality of values of a plurality of nodesof the other 3D-Tagtree, and selecting the entropy-encoded plurality ofvalues of the plurality of nodes of one of the 3D-Tagtree and the other3D-Tagtree that has a higher rate distortion.

The 3D-Tree may be a 3D-Unitree. Based on child nodes of a parent nodeincluded in a depth other than a last depth of the 3D-Unitree havingdifferent values, a value of the parent node may be 1. Based on thechild nodes of the parent node having identical values, the value of theparent node may be 0. Based on codebook indices or absolute values ofcoefficients of a respective one of the plurality of CU3Ds havingdifferent values, a value of a node included in the last depth may be 1.Based on the codebook indices or the absolute values of the coefficientsof the respective one of the plurality of CU3Ds having identical values,the value of the node included in the last depth may be 0.

The method 700 may further include constructing a 3D-Tagtree for each ofthe plurality of CU3Ds. Based on an absolute value of a codebook indexor coefficient of the respective one of the plurality of CU3Ds beingother than zero, a value of a node included in a last depth of the3D-Tagtree may be 1. Based on the absolute value of the codebook indexor coefficient of the respective one of the plurality of CU3Ds beingzero, the value of the node included in the last depth of the 3D-Tagtreemay be 0. A value of a parent node at another depth of the 3D-Tagtreemay be a minimum value of child nodes of the parent node of the3D-Tagtree. The entropy encoding each of the plurality of values of theplurality of nodes of the 3D-Tree may include entropy encoding a valueof a current node of the 3D-Unitree, based on the entropy-encoded valueof the current node of the 3D-Unitree being zero, skipping entropyencoding of values of child nodes of the current node of the 3D-Unitree,based on the entropy-encoded value of the current node of the 3D-Unitreebeing other than zero and the current node of the 3D-Unitree being a topnode, entropy encoding a value of a current node of the 3D-Tagtreecorresponding to the current node of the 3D-Unitree, and based on theentropy-encoded value of the current node of the 3D-Unitree being otherthan zero and the current node of the 3D-Unitree not being the top node,entropy encoding a difference between the value of the current node ofthe 3D-Tagtree and a value of a parent node of the current node of the3D-Tagtree.

The method 700 may further include reordering two-dimensional (2D)planes in at least one of the CTU3Ds and the plurality of CU3Ds, alongan axis that is formed by the convolutional kernel size, to generatereorder indices respectively corresponding to orders of the 2D planes,and encoding the reorder indices in a header of the at least one of theCTU3Ds and the plurality of CU3Ds.

Although FIG. 7 shows example blocks of the method 700, in someimplementations, the method 700 may include additional blocks, fewerblocks, different blocks, or differently arranged blocks than thosedepicted in FIG. 7 . Additionally, or alternatively, two or more of theblocks of the method 700 may be performed in parallel.

FIG. 8 is a diagram of an apparatus 800 for adaptive block partitioningfor neural network model compression, according to embodiments. As shownin FIG. 8 , the apparatus 800 includes reshaping code 810, firstpartitioning code 820, second partitioning code 830, first constructingcode 840 and first entropy encoding code 850.

The reshaping code 810 is configured to cause at least one processor ofthe apparatus 800 to reshape a four-dimensional (4D) parameter tensor ofa neural network into 3D parameter tensor of the neural network, the 3Dparameter tensor including a convolution kernel size, an input featuresize and an output feature size.

The first partitioning code 820 is configured to cause the at least oneprocessor to partition the 3D parameter tensor along a plane that isformed by the input feature size and the output feature size, into 3Dcoding tree units (CTU3Ds).

The second partitioning code 830 is configured to cause the at least oneprocessor to partition each of the CTU3Ds into a plurality of 3D codingunits (CU3Ds) recursively until a maximum depth, using a quad-tree.

The first constructing code 840 is configured to cause the at least oneprocessor to construct a 3D-Tree for each of the plurality of CU3Ds.

The first entropy encoding code 850 is configured to cause the at leastone processor to entropy encode each of a plurality of values of aplurality of nodes of the 3D-Tree.

The 3D-Tree may be a 3D-Octree. Based on a codebook index or coefficientof a respective one of the plurality of CU3Ds being other than zero, avalue of a node included in a last depth of the 3D-Octree may be 1.Based on the codebook index or coefficient of the respective one of theplurality of CU3Ds being zero, the value of the node included in thelast depth of the 3D-Octree may be 0. A value of a parent node atanother depth of the 3D-Octree may be a maximum or minimum value ofchild nodes of the parent node.

The 3D-Tree may be a 3D-Tagtree. Based on an absolute value of acodebook index or coefficient of a respective one of the plurality ofCU3Ds being other than zero, a value of a node included in a last depthof the 3D-Tagtree may be 1. Based on the absolute value of the codebookindex or coefficient of the respective one of the plurality of CU3Dsbeing zero, the value of the node included in the last depth of the3D-Tagtree may be 0. A value of a parent node at another depth of the3D-Tagtree may be a maximum value of child nodes of the parent node.

The apparatus 800 may further include second constructing code 860configured to cause the at least one processor to construct another3D-Tagtree for each of the plurality of CU3Ds. Based on the absolutevalue of the codebook index or coefficient of the respective one of theplurality of CU3Ds being other than zero, a value of a node included ina last depth of the other 3D-Tagtree may be 1. Based on the absolutevalue of the codebook index or coefficient of the respective one of theplurality of CU3Ds being zero, the value of the node included in thelast depth of the other 3D-Tagtree may be 0. A value of a parent node atanother depth of the other 3D-Tagtree may be a minimum value of childnodes of the parent node of the other 3D-Tagtree. The apparatus 800 mayfurther include second entropy encoding code 870 configured to cause theat least one processor to entropy encode each of a plurality of valuesof a plurality of nodes of the other 3D-Tagtree, and selecting code 880configured to cause the at least one processor to select theentropy-encoded plurality of values of the plurality of nodes of one ofthe 3D-Tagtree and the other 3D-Tagtree that has a higher ratedistortion.

The 3D tree may be a 3D-Unitree. Based on child nodes of a parent nodeincluded in a depth other than a last depth of the 3D-Unitree havingdifferent values, a value of the parent node may be 1. Based on thechild nodes of the parent node having identical values, the value of theparent node may be 0. Based on codebook indices or absolute values ofcoefficients of a respective one of the plurality of CU3Ds havingdifferent values, a value of a node included in the last depth may be 1.Based on the codebook indices or the absolute values of the coefficientsof the respective one of the plurality of CU3Ds having identical values,the value of the node included in the last depth may be 0.

The second constructing code 860 may be further configured to cause theat least one processor to construct a 3D-Tagtree for each of theplurality of CU3Ds. Based on an absolute value of a codebook index orcoefficient of the respective one of the plurality of CU3Ds beingnon-zero, a value of a node included in a last depth of the 3D-Tagtreemay be 1. Based on the absolute value of the codebook index orcoefficient of the respective one of the plurality of CU3Ds being zero,the value of the node included in the last depth of the 3D-Tagtree maybe 0. A value of a parent node at another depth of the 3D-Tagtree may bea minimum value of child nodes of the parent node of the 3D-Tagtree. Thefirst entropy encoding 850 may be further configured to cause the atleast one processor to entropy encode a value of a current node of the3D-Unitree, based on the entropy-encoded value of the current node ofthe 3D-Unitree being zero, skip entropy encoding of values of childnodes of the current node of the 3D-Unitree, based on theentropy-encoded value of the current node of the 3D-Unitree beingnon-zero and the current node of the 3D-Unitree being a top node,entropy encode a value of a current node of the 3D-Tagtree correspondingto the current node of the 3D-Unitree, and based on the entropy-encodedvalue of the current node of the 3D-Unitree being non-zero and thecurrent node of the 3D-Unitree not being the top node, entropy encode adifference between the value of the current node of the 3D-Tagtree and avalue of a parent node of the current node of the 3D-Tagtree.

The apparatus 800 may further include reordering code 890 configured tocause the at least one processor to reorder two-dimensional (2D) planesin at least one of the CTU3Ds and the plurality of CU3Ds, along an axisthat is formed by the convolutional kernel size, to generate reorderindices respectively corresponding to orders of the 2D planes, andencoding code 900 configured to cause the at least one processor toencode the reorder indices in a header of the at least one of the CTU3Dsand the plurality of CU3Ds.

The foregoing disclosure provides illustration and description, but isnot intended to be exhaustive or to limit the implementations to theprecise form disclosed. Modifications and variations are possible inlight of the above disclosure or may be acquired from practice of theimplementations.

As used herein, the term component is intended to be broadly construedas hardware, firmware, or a combination of hardware and software.

It will be apparent that systems and/or methods, described herein, maybe implemented in different forms of hardware, firmware, or acombination of hardware and software. The actual specialized controlhardware or software code used to implement these systems and/or methodsis not limiting of the implementations. Thus, the operation and behaviorof the systems and/or methods were described herein without reference tospecific software code—it being understood that software and hardwaremay be designed to implement the systems and/or methods based on thedescription herein.

Even though combinations of features are recited in the claims and/ordisclosed in the specification, these combinations are not intended tolimit the disclosure of possible implementations. In fact, many of thesefeatures may be combined in ways not specifically recited in the claimsand/or disclosed in the specification. Although each dependent claimlisted below may directly depend on only one claim, the disclosure ofpossible implementations includes each dependent claim in combinationwith every other claim in the claim set.

No element, act, or instruction used herein may be construed as criticalor essential unless explicitly described as such. Also, as used herein,the articles “a” and “an” are intended to include one or more items, andmay be used interchangeably with “one or more.” Furthermore, as usedherein, the term “set” is intended to include one or more items (e.g.,related items, unrelated items, a combination of related and unrelateditems, etc.), and may be used interchangeably with “one or more.” Whereonly one item is intended, the term “one” or similar language is used.Also, as used herein, the terms “has,” “have,” “having,” or the like areintended to be open-ended terms. Further, the phrase “based on” isintended to mean “based, at least in part, on” unless explicitly statedotherwise.

What is claimed is:
 1. A method of three-dimensional (3D)-Tree codingfor neural network model compression, the method being performed by atleast one processor, and the method comprising: reshaping afour-dimensional (4D) parameter tensor of a neural network into a 3Dparameter tensor of the neural network, the 3D parameter tensorcomprising a convolution kernel size, an input feature size, and anoutput feature size; partitioning the 3D parameter tensor along a planethat is formed by the input feature size and the output feature sizeinto 3D coding tree units (CTU3Ds); partitioning each of the CTU3Ds intoa plurality of 3D coding units (CU3Ds) recursively until a predetermineddepth, using a quad-tree; constructing a 3D-Unitree for each of theplurality of CU3Ds; constructing a 3D-Tagtree for each of the pluralityof CU3Ds; based on a value of a parent node of the 3D-Unitree beingzero, encoding a corresponding unified value and skipping scanning oneor more child nodes; and based on the value of the parent node of the3D-Unitree being non-zero, encoding the value of the parent node of the3D-Unitree with one of a corresponding Tagtree value or a difference inthe corresponding Tagtree value between the parent node and the one ormore child nodes.
 2. The method of claim 1, wherein a predeterminedencoding start depth indicates a first depth at which nodes are to beincluded in an encoding process.
 3. The method of claim 2, wherein themethod comprises a predefined scan order, and wherein one or more nodeswith a depth above the predetermined encoding start depth are skipped.4. The method of claim 1, further comprising, based on a value of a nodeat a lowest depth being non-zero, encoding the 3D-Unitree using a directquantization method.
 5. The method of claim 1, further comprising, basedon a value of a node at a lowest depth being non-zero, encoding the3D-Tagtree using a direct quantization method.
 6. The method of claim 1,further comprising, based on the parent node of the 3D-Unitree havingone or more absent child nodes, skipping encoding the one or more absentchild nodes.
 7. The method of claim 1, wherein constructing a 3D-Unitreecomprises: based on child nodes of the parent node included in a depthother than a last depth of the 3D-Unitree having different values, thevalue of the parent node of the 3D-Unitree is 1, based on the childnodes of the parent node having identical values, the value of theparent node of the 3D-Unitree is 0, based on codebook indices orabsolute values of coefficients of a respective one of the plurality ofCU3Ds having different values, a value of a node included in the lastdepth of the 3D-Unitree is 1, and based on the codebook indices or theabsolute values of the coefficients of the respective one of theplurality of CU3Ds having identical values, the value of the nodeincluded in the last depth of the 3D-Unitree is
 0. 8. An apparatus foradaptive block partitioning for neural network model compression, theapparatus comprising: at least one memory configured to store programcode; and at least one processor configured to read the program code andoperate as instructed by the program code, the program code comprising:reshaping code configured to cause the at least one processor to reshapea four-dimensional (4D) parameter tensor of a neural network into a 3Dparameter tensor of the neural network, the 3D parameter tensorcomprising a convolution kernel size, an input feature size, and anoutput feature size; first partitioning code configured to cause the atleast one processor to partition the 3D parameter tensor along a planethat is formed by the input feature size and the output feature size,into 3D coding tree units (CTU3Ds); second partitioning code configuredto cause the at least one processor to partition each of the CTU3Ds intoa plurality of 3D coding units (CU3Ds) recursively until a maximumdepth, using a quad-tree; first constructing code configured to causethe at least one processor to construct a 3D-Unitree for each of theplurality of CU3Ds; second constructing code configured to cause the atleast one processor to construct a 3D-Tagtree for each of the pluralityof CU3Ds; first encoding code configured to cause the at least oneprocessor to, based on a value of a parent node of the 3D-Unitree beingzero, encode a corresponding unified value and skipping scanning one ormore child nodes; and second encoding code configured to cause the atleast one processor to, based on the value of the parent node of the3D-Unitree being non-zero, encode the value of the parent node of the3D-Unitree with one of a corresponding Tagtree value or a difference inthe corresponding Tagtree value between the parent node and the one ormore child nodes.
 9. The apparatus of claim 8, wherein a predeterminedencoding start depth indicates a first depth at which nodes are to beincluded in an encoding process.
 10. The apparatus of claim 9, whereinthe program code further comprises scanning code configured to cause theat least one processor to scan nodes in a predefined scan order, andwherein one or more nodes with a depth above the predetermined encodingstart depth are skipped.
 11. The apparatus of claim 8, furthercomprising third encoding code configured to cause the at least oneprocessor to, based on a value of a node at a lowest depth beingnon-zero, encode the 3D-Unitree using direct quantization.
 12. Theapparatus of claim 8, further comprising third encoding code configuredto cause the at least one processor to, based on a value of a node at alowest depth being non-zero, encode the 3D-Tagtree using directquantization.
 13. The apparatus of claim 8, further comprising, fourthencoding code configured to cause the at least one processor to, basedon the parent node of the 3D-Unitree having one or more absent childnodes, skip encoding the one or more absent child nodes.
 14. Anon-transitory computer-readable medium storing instructions that, whenexecuted by at least one processor for adaptive block partitioning forneural network model compression, cause the at least one processor to:reshape a four-dimensional (4D) parameter tensor of a neural networkinto a 3D parameter tensor of the neural network, the 3D parametertensor comprising a convolution kernel size, an input feature size, andan output feature size; partition the 3D parameter tensor along a planethat is formed by the input feature size and the output feature sizeinto 3D coding tree units (CTU3Ds); partition each of the CTU3Ds into aplurality of 3D coding units (CU3Ds) recursively until a predetermineddepth, using a quad-tree; construct a 3D-Unitree for each of theplurality of CU3Ds; construct a 3D-Tagtree for each of the plurality ofCU3Ds; based on a value of a parent node of the 3D-Unitree being zero,encode a corresponding unified value and skipping scanning one or morechild nodes; and based on the value of the parent node of the 3D-Unitreebeing non-zero, encode the value of the parent node of the 3D-Unitreewith one of a corresponding Tagtree value or a difference in thecorresponding Tagtree value between the parent node and the one or morechild nodes.
 15. The non-transitory computer-readable medium of claim14, wherein a predetermined encoding start depth indicates a first depthat which nodes are to be included in an encoding process.
 16. Thenon-transitory computer-readable medium of claim 15, wherein theinstructions when executed by the at least one processor, further causethe at least one processor to, scan nodes in a predefined scan order,and wherein one or more nodes with a depth above the predeterminedencoding start depth are skipped.
 17. The non-transitorycomputer-readable medium of claim 14, wherein the instructions, whenexecuted by the at least one processor, further cause the at least oneprocessor to, based on a value of a node at a lowest depth beingnon-zero, encode the 3D-Unitree using a direct quantization method. 18.The non-transitory computer-readable medium of claim 14, wherein theinstructions, when executed by the at least one processor, further causethe at least one processor to, based on a value of a node at a lowestdepth being non-zero, encode the 3D-Tagtree using a direct quantizationmethod.
 19. The non-transitory computer-readable medium of claim 14,wherein the instructions, when executed by the at least one processor,further cause the at least one processor to, based on the parent node ofthe 3D-Unitree having one or more absent child nodes, skip encoding theone or more absent child nodes.
 20. The non-transitory computer-readablemedium of claim 14, wherein constructing a 3D-Unitree comprises: basedon child nodes of the parent node included in a depth other than a lastdepth of the 3D-Unitree having different values, the value of the parentnode of the 3D-Unitree is 1, based on the child nodes of the parent nodehaving identical values, the value of the parent node of the 3D-Unitreeis 0, based on codebook indices or absolute values of coefficients of arespective one of the plurality of CU3Ds having different values, avalue of a node included in the last depth of the 3D-Unitree is 1, andbased on the codebook indices or the absolute values of the coefficientsof the respective one of the plurality of CU3Ds having identical values,the value of the node included in the last depth of the 3D-Unitree is 0.